Changeset 1814


Ignore:
Timestamp:
04/22/12 01:32:32 (14 months ago)
Author:
reyalp
Message:

updating live view branch with trunk changes up to r1811

Location:
branches/reyalp-ptp-live
Files:
2 deleted
139 edited
14 copied

Legend:

Unmodified
Added
Removed
  • branches/reyalp-ptp-live

  • branches/reyalp-ptp-live/CHDK/LANG/english.lng

    r1720 r1814  
    436436335 "Mute during zooming" 
    437437 
    438 336 "Bad pixel removal" 
     438336 "Manual bad pixel removal" 
    439439337 "Off" 
    440440338 "Averag." 
     
    672672 
    673673551 "Enable script start" 
     674 
     675552 "Disable Zoom Assist button" 
     676 
     677553 "DNG version" 
  • branches/reyalp-ptp-live/CHDK/LANG/german.lng

    r1720 r1814  
    685685 
    686686550 "Abbruch mit [Auslöser halb]" 
     687 
     688551 "Skript-Start an/aus" 
     689 
     690552 "Taste Zoom-Assistent deaktivieren" 
     691 
     692553 "DNG-Version" 
  • branches/reyalp-ptp-live/CHDK/Makefile

    r1505 r1814  
    11topdir=../ 
    22include $(topdir)makefile.inc 
     3 
     4ifndef OPT_DE_VERSION 
     5LOGO=logo.dat 
     6else 
     7LOGO=logo_de.dat 
     8endif 
    39 
    410GENLUA=LUALIB/GEN/propset1.lua LUALIB/GEN/propset2.lua LUALIB/GEN/propset3.lua LUALIB/GEN/propset4.lua LUALIB/GEN/modelist.lua 
    511# generate some lua files from CHDK source 
    612all: $(GENLUA) 
     13        @echo "copy" $(LOGO) 
     14        mkdir -p $(topdir)CHDK/DATA 
     15        cp $(topdir)CHDK/$(LOGO) $(topdir)CHDK/DATA/$(LOGO) 
    716 
    817LUALIB/GEN/propset1.lua:  $(topdir)include/propset1.h 
     
    2837clean: 
    2938        rm -f $(GENLUA) 
     39        rm -f $(topdir)CHDK/DATA/$(LOGO) 
    3040        rm -f MODULES/*.flt 
    3141 
  • branches/reyalp-ptp-live/Makefile

    r1813 r1814  
    2222endif 
    2323tmp:=$(shell echo "BUILD_SVNREV := $(BUILD_SVNREV)" > revision.inc) 
     24 
     25# CHDK folder for full package 
     26ZIPDIRS:=$(shell ls -R CHDK | grep CHDK/ | $(ESED) 's?:?/*?') 
    2427 
    2528SUBDIRS=tools lib platform core loader CHDK 
     
    133136        LANG=C echo -e "CHDK-$(VER) for $(PLATFORM) fw:$(PLATFORMSUB) build:$(BUILD_NUMBER)$(STATE) date:`date -R`" | \ 
    134137        zip -9jz $(topdir)bin/$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)$(STATE).zip $(topdir)bin/DISKBOOT.BIN > $(DEVNULL) 
    135         zip -9 $(topdir)bin/$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)-full$(STATE).zip $(topdir)CHDK/SYMBOLS/*  > $(DEVNULL) 
    136         zip -9 $(topdir)bin/$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)-full$(STATE).zip $(topdir)CHDK/BOOKS/*  > $(DEVNULL) 
    137         zip -9 $(topdir)bin/$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)-full$(STATE).zip $(topdir)CHDK/CURVES/*  > $(DEVNULL) 
    138     ifeq ($(VER),CHDK-DE) 
    139                 zip -9 $(topdir)bin/$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)-full$(STATE).zip $(topdir)CHDK/CURVES/ISOBoost/*  > $(DEVNULL) 
    140     endif 
    141         zip -9 $(topdir)bin/$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)-full$(STATE).zip $(topdir)CHDK/DATA/*  > $(DEVNULL) 
    142         zip -9 $(topdir)bin/$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)-full$(STATE).zip $(topdir)CHDK/FONTS/*  > $(DEVNULL) 
    143         zip -9 $(topdir)bin/$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)-full$(STATE).zip $(topdir)CHDK/GAMES/*   > $(DEVNULL) 
    144         zip -9 $(topdir)bin/$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)-full$(STATE).zip $(topdir)CHDK/GRIDS/* > $(DEVNULL) 
    145         zip -9 $(topdir)bin/$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)-full$(STATE).zip $(topdir)CHDK/LANG/*   > $(DEVNULL) 
    146         zip -9 $(topdir)bin/$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)-full$(STATE).zip $(topdir)CHDK/LUALIB/*   > $(DEVNULL) 
    147         zip -9 $(topdir)bin/$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)-full$(STATE).zip $(topdir)CHDK/LUALIB/GEN/*   > $(DEVNULL) 
    148         zip -9 $(topdir)bin/$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)-full$(STATE).zip $(topdir)CHDK/SCRIPTS/*  > $(DEVNULL) 
    149         zip -9 $(topdir)bin/$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)-full$(STATE).zip $(topdir)CHDK/SCRIPTS/EXAM/*     > $(DEVNULL) 
    150         zip -9 $(topdir)bin/$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)-full$(STATE).zip $(topdir)CHDK/SCRIPTS/TEST/*     > $(DEVNULL) 
    151     ifeq ($(VER),CHDK-DE) 
    152                 zip -9 $(topdir)bin/$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)-full$(STATE).zip $(topdir)CHDK/SCRIPTS/MD/*   > $(DEVNULL) 
    153                 zip -9 $(topdir)bin/$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)-full$(STATE).zip $(topdir)CHDK/SCRIPTS/CURV/*     > $(DEVNULL) 
    154                 zip -9 $(topdir)bin/$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)-full$(STATE).zip $(topdir)CHDK/SCRIPTS/USER/* > $(DEVNULL) 
    155     else 
    156                 zip -9 $(topdir)bin/$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)-full$(STATE).zip $(topdir)CHDK/SCRIPTS/EDITOR/*   > $(DEVNULL) 
    157     endif 
     138        $(foreach ZIPDIR, $(ZIPDIRS), \ 
     139                zip -9 $(topdir)bin/$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)-full$(STATE).zip $(topdir)$(ZIPDIR) > $(DEVNULL) ; \ 
     140        ) 
    158141        zip -9 $(topdir)bin/$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)-full$(STATE).zip $(topdir)CHDK/syscurves.CVF      > $(DEVNULL) 
    159142        zip -9j $(topdir)bin/$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)-full$(STATE).zip $(topdir)doc/changelog.txt  > $(DEVNULL) 
     
    163146        zip -9j $(topdir)bin/$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)-full$(STATE).zip $(topdir)doc/readme.txt  > $(DEVNULL) 
    164147        zip -9j $(topdir)bin/$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)$(STATE).zip $(topdir)doc/readme.txt  > $(DEVNULL) 
    165         zip -9 $(topdir)bin/$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)-full$(STATE).zip $(topdir)CHDK/MODULES/*  > $(DEVNULL) 
    166148        zip -9 $(topdir)bin/$(PLATFORM)-$(PLATFORMSUB)-$(BUILD_NUMBER)$(STATE).zip $(topdir)CHDK/MODULES/*  > $(DEVNULL) 
    167149 
  • branches/reyalp-ptp-live/buildconf.inc

    r1813 r1814  
    1616# WARNING: This is DANGEROUS. e.g. call_event_proc("EraseSectorOfRom",...) 
    1717# NOTE: the interface for this may change in the future, to support better support buffers etc 
    18 ifeq ($(VER),CHDK-DE) 
    19 OPT_LUA_CALL_NATIVE=1 
    20 endif 
     18#OPT_LUA_CALL_NATIVE=1 
    2119 
    2220# experimental - allocate memory from alternate heap. Default 2MB from EXMEM_RAMDISK 
     
    4644# for people who won't use lang files at all / not done yet 
    4745#!OPT_LANGUAGEINTERFACE=1 
     46# for CHDK-DE presets without OPT_DEFAULT_LANG 
     47#OPT_DE_VERSION=1 
    4848 
    4949# Override the value below to compile a different default language into 
     
    5151# desired language. 
    5252# Set the value to the language file name without extension - e.g. OPT_DEFAULT_LANG=russian 
    53 ifeq ($(VER),CHDK-DE) 
    54 OPT_DEFAULT_LANG=german 
    55 endif 
     53#OPT_DEFAULT_LANG= 
    5654 
    57 # Default svn revsion. Used when svnversion fail. 
     55# Default svn revision. Used when svnversion fail. 
    5856DEF_SVN_REF=0 
  • branches/reyalp-ptp-live/camera_list.csv

    r1737 r1814  
    4444a710,100a,,, 
    4545a720,100c,,, 
     46a800,100b,BETA,, 
    4647a800,100c,BETA,, 
    4748d10,100a,BETA,100b, 
     
    5657g12,100f,,, 
    5758g12,100g,,, 
     59g1x,100f,ALPHA,, 
    5860g7,100e,,, 
    5961g7,100g,,, 
     
    6567ixus1000_sd4500,100d,BETA,, 
    6668ixus1000_sd4500,100f,BETA,, 
     69ixus1000_sd4500,102b,BETA,, 
    6770ixus100_sd780,100b,BETA,, 
    6871ixus100_sd780,100c,BETA,, 
     
    141144s95,100i,BETA,, 
    142145s95,100k,BETA,, 
     146s100,100d,ALPHA,, 
     147s100,100e,ALPHA,, 
     148s100,101a,ALPHA,, 
    143149sx1,200h,BETA,, 
    144150sx1,201a,BETA,, 
  • branches/reyalp-ptp-live/core/conf.c

    r1737 r1814  
    375375    //CONF_INFO(224, conf.edge_overlay_zoom,          CONF_DEF_VALUE, i:1, NULL),               // moved to edge overlay module 
    376376    CONF_INFO(225, conf.raw_cache,                  CONF_DEF_VALUE, i:0, NULL), 
    377     CONF_INFO(226, conf.dng_raw,                    CONF_DEF_VALUE, i:0, conf_change_dng), 
     377    CONF_INFO(226, conf.dng_raw,                    CONF_DEF_VALUE, i:1, conf_change_dng), 
    378378    CONF_INFO(227, conf.flash_sync_curtain,         CONF_DEF_VALUE, i:0, NULL), 
    379379    CONF_INFO(228, conf.raw_timer,                  CONF_DEF_VALUE, i:0, NULL), 
     
    383383    CONF_INFO(232, conf.flash_video_override,       CONF_DEF_VALUE, i:0, NULL), 
    384384    CONF_INFO(233, conf.flash_video_override_power, CONF_DEF_VALUE, i:0, NULL), 
    385     CONF_INFO(234, conf.raw_dng_ext,                CONF_DEF_VALUE, i:0, NULL), 
     385    CONF_INFO(234, conf.raw_dng_ext,                CONF_DEF_VALUE, i:1, NULL), 
    386386    CONF_INFO(235, conf.dng_usb_ext,                CONF_DEF_VALUE, i:0, conf_change_dng_ext), 
    387387    CONF_INFO(236, conf.flash_manual_override,      CONF_DEF_VALUE, i:0, NULL), 
     
    454454    CONF_INFO(286, conf.overexp_threshold,          CONF_DEF_VALUE,     i:5, NULL), 
    455455    CONF_INFO(287, conf.overexp_ev_enum,            CONF_DEF_VALUE,     i:3, conf_change_autoiso), 
     456 
     457#if defined(CAM_ZOOM_ASSIST_BUTTON_CONTROL) 
     458    CONF_INFO(288, conf.zoom_assist_button_disable, CONF_DEF_VALUE,     i:0, NULL), 
     459#endif 
     460 
     461    CONF_INFO(289, conf.dng_version,                CONF_DEF_VALUE,     i:0, conf_change_dng), 
    456462    }; 
    457463#define CONF_NUM (sizeof(conf_info)/sizeof(conf_info[0])) 
     
    472478    case 194: conf_change_script_file(); break; 
    473479    case 2: 
    474     case 226: conf_change_dng(); break; 
     480    case 226:  
     481    case 289: conf_change_dng(); break; 
    475482    case 235: conf_change_dng_ext(); break; 
    476483    case 284: conf_change_autoiso(); break; 
     
    514521void conf_change_dng(void){ 
    515522#if DNG_SUPPORT 
    516  if (conf.save_raw && conf.dng_raw) { 
     523 if (conf.save_raw && conf.dng_raw && conf.dng_version) { 
    517524        if ( !module_dng_load(LIBDNG_OWNED_BY_RAW) ) 
    518                 return; 
    519         if (!libdng->badpixel_list_loaded_b()) libdng->load_bad_pixels_list_b("A/CHDK/badpixel.bin"); 
    520         if (!libdng->badpixel_list_loaded_b()) conf.dng_raw=0; 
     525        return; 
     526    if (!libdng->badpixel_list_loaded_b()) libdng->load_bad_pixels_list_b("A/CHDK/badpixel.bin"); 
     527    if (!libdng->badpixel_list_loaded_b()) conf.dng_version=0; 
    521528 } 
    522529 else if ( libdng && libdng->load_bad_pixels_list_b ) { 
    523         libdng->load_bad_pixels_list_b(0);        //unload badpixel.bin 
     530    libdng->load_bad_pixels_list_b(0);        //unload badpixel.bin 
    524531        module_dng_unload(LIBDNG_OWNED_BY_RAW); 
    525532 } 
  • branches/reyalp-ptp-live/core/dng.c

    r1813 r1814  
    2020struct dir_entry{unsigned short tag; unsigned short type; unsigned int count; unsigned int offset;}; 
    2121 
    22 #define T_END       0 
    2322#define T_BYTE      1 
    2423#define T_ASCII     2 
     
    3433#define T_DOUBLE    12 
    3534#define T_PTR       0x100   // Stored as long/short etc in DNG header, referenced by pointer in IFD (must be pointer to int variable) 
     35#define T_SKIP      0x200   // Tag value to be skipped (for marking GPS entries if camera does not have GPS) 
    3636 
    3737unsigned short get_exp_program_for_exif(int exp_program); 
     
    4848const char cam_chdk_ver[]               = HDK_VERSION" ver. "BUILD_NUMBER; 
    4949const int cam_Resolution[]              = {180,1}; 
    50 int cam_AsShotNeutral[]                 = {1000,1000,1000,1000,1000,1000}; 
     50static int cam_AsShotNeutral[]          = {1000,1000,1000,1000,1000,1000}; 
     51static char cam_datetime[20]            = "";                   // DateTimeOriginal 
     52static int cam_shutter[2]               = { 0, 1000000 };       // Shutter speed 
     53static int cam_aperture[2]              = { 0, 10 };            // Aperture 
     54static int cam_apex_shutter[2]          = { 0, 96 };            // Shutter speed in APEX units 
     55static int cam_apex_aperture[2]         = { 0, 96 };            // Aperture in APEX units 
     56static int cam_exp_bias[2]              = { 0, 96 }; 
     57static int cam_max_av[2]                = { 0, 96 }; 
     58static int cam_focal_length[2]          = { 0, 1000 }; 
    5159 
    5260struct t_data_for_exif{ 
    53  short iso; 
    54  int exp_program; 
    55  int effective_focal_length; 
    56  short orientation; 
    57  short flash_mode; 
    58  short flash_fired; 
    59  short metering_mode; 
     61    short iso; 
     62    int exp_program; 
     63    int effective_focal_length; 
     64    short orientation; 
     65    short flash_mode; 
     66    short flash_fired; 
     67    short metering_mode; 
    6068}; 
    6169 
    6270static struct t_data_for_exif exif_data; 
    6371 
     72#define BE(v)   ((v&0x000000FF)<<24)|((v&0x0000FF00)<<8)|((v&0x00FF0000)>>8)|((v&0xFF000000)>>24)   // Convert to big_endian 
     73 
     74static unsigned int badpixel_opcode[] = 
     75{ 
     76    // *** all values must be in big endian order 
     77 
     78    BE(1),              // Count = 1 
     79 
     80    BE(4),              // FixBadPixelsConstant = 4 
     81    BE(0x01030000),     // DNG version = 1.3.0.0 
     82    BE(1),              // Flags = 1 
     83    BE(8),              // Opcode length = 8 bytes 
     84    BE(0),              // Constant = 0 
     85#if   cam_CFAPattern == 0x02010100 
     86    BE(1),              // BayerPhase = 1 (top left pixel is green in a green/red row) 
     87#elif cam_CFAPattern == 0x01020001 
     88    BE(0),              // BayerPhase = 0 (top left pixel is red) 
     89#elif cam_CFAPattern == 0x01000201 
     90    BE(3),              // BayerPhase = 3 (top left pixel is blue) 
     91#elif cam_CFAPattern == 0x00010102 
     92    BE(2),              // BayerPhase = 2 (top left pixel is green in a green/blue row) 
     93#endif 
     94}; 
     95 
    6496// warning: according to TIFF format specification, elements must be sorted by tag value in ascending order! 
    6597 
    66 struct dir_entry IFD0[]={ 
    67  {0xFE,   T_LONG,       1,  1},                                 // NewSubFileType: Preview Image 
    68  {0x100,  T_LONG,       1,  DNG_TH_WIDTH},                      // ImageWidth 
    69  {0x101,  T_LONG,       1,  DNG_TH_HEIGHT},                     // ImageLength 
    70  {0x102,  T_SHORT,      3,  (int)cam_PreviewBitsPerSample},     // BitsPerSample: 8,8,8 
    71  {0x103,  T_SHORT,      1,  1},                                 // Compression: Uncompressed 
    72  {0x106,  T_SHORT,      1,  2},                                 //PhotometricInterpretation: RGB 
    73  {0x10E,  T_ASCII,      1,  0},                                 // ImageDescription 
    74  {0x10F,  T_ASCII,      sizeof(CAM_MAKE), (int)CAM_MAKE},       // Make 
    75  {0x110,  T_ASCII,      32, (int)cam_name},                     //Model: Filled at header generation. 
    76  {0x111,  T_LONG,       1,  0},                                 //StripOffsets: Offset 
    77  {0x112,  T_SHORT,      1,  1},                                 //Orientation: 1 - 0th row is top, 0th column is left 
    78  {0x115,  T_SHORT,      1,  3},                                 // SamplesPerPixel: 3 
    79  {0x116,  T_SHORT,      1,  DNG_TH_HEIGHT},                     //RowsPerStrip 
    80  {0x117,  T_LONG,       1,  DNG_TH_WIDTH*DNG_TH_HEIGHT*3},      // StripByteCounts = preview size 
    81  {0x11C,  T_SHORT,      1,  1},                                 // PlanarConfiguration: 1 
    82  {0x131,  T_ASCII,      sizeof(cam_chdk_ver), (int)cam_chdk_ver},//Software 
    83  {0x132,  T_ASCII,      20, 0},                                 // DateTime 
    84  {0x14A,  T_LONG,       1,  0},                                 //SubIFDs offset 
    85  {0x8298, T_ASCII,      1,  0},                                 // Copyright 
    86  {0x8769, T_LONG,       1,  0},                                 //EXIF_IFD offset 
    87  {0x8825, T_LONG,       1,  0},                                 //GPS_IFD offset 
    88  {0x9216, T_BYTE,       4,  0x00000001},                        // TIFF/EPStandardID: 1.0.0.0 
    89  {0xC612, T_BYTE,       4,  0x00000101},                        //DNGVersion: 1.1.0.0 
    90  {0xC614, T_ASCII,      32, (int)cam_name},                     //UniqueCameraModel. Filled at header generation. 
    91  {0xC621, T_SRATIONAL,  9,  (int)&camera_sensor.color_matrix1}, 
    92  {0xC627, T_RATIONAL,   3,  (int)cam_AnalogBalance}, 
    93  {0xC628, T_RATIONAL,   3,  (int)cam_AsShotNeutral}, 
    94  {0xC62A, T_SRATIONAL,  1,  (int)&camera_sensor.exposure_bias}, 
    95  {0xC62B, T_RATIONAL,   1,  (int)cam_BaselineNoise}, 
    96  {0xC62C, T_RATIONAL,   1,  (int)cam_BaselineSharpness}, 
    97  {0xC62E, T_RATIONAL,   1,  (int)cam_LinearResponseLimit}, 
    98  {0xC630, T_RATIONAL,   4,  (int)&camera_sensor.lens_info}, 
    99  {0xC65A, T_SHORT|T_PTR,1,  (int)&camera_sensor.calibration_illuminant1},  
    100  {0, T_END} 
    101 }; 
    102  
    103                                                                                        
    104 struct dir_entry IFD1[]={ 
    105  {0xFE,   T_LONG,       1,  0},                                 // NewSubFileType: Main Image 
    106  {0x100,  T_LONG|T_PTR, 1,  (int)&camera_sensor.raw_rowpix},      // ImageWidth 
    107  {0x101,  T_LONG|T_PTR, 1,  (int)&camera_sensor.raw_rows},        // ImageLength 
    108  {0x102,  T_SHORT|T_PTR,1,  (int)&camera_sensor.bits_per_pixel},  // BitsPerSample 
    109  {0x103,  T_SHORT,      1,  1},                                 // Compression: Uncompressed 
    110  {0x106,  T_SHORT,      1,  0x8023},                            //PhotometricInterpretation: CFA 
    111  {0x111,  T_LONG,       1,  0},                                 //StripOffsets: Offset 
    112  {0x115,  T_SHORT,      1,  1},                                 // SamplesPerPixel: 1 
    113  {0x116,  T_SHORT|T_PTR,1,  (int)&camera_sensor.raw_rows},        //RowsPerStrip 
    114  {0x117,  T_LONG|T_PTR, 1,  (int)&camera_sensor.raw_size},        // StripByteCounts = CHDK RAW size 
    115  {0x11A,  T_RATIONAL,   1,  (int)cam_Resolution},               // XResolution 
    116  {0x11B,  T_RATIONAL,   1,  (int)cam_Resolution},               // YResolution 
    117  {0x11C,  T_SHORT,      1,  1},                                 // PlanarConfiguration: 1 
    118  {0x128,  T_SHORT,      1,  2},                                 // ResolutionUnit: inch 
    119  {0x828D, T_SHORT,      2,  0x00020002},                        // CFARepeatPatternDim: Rows = 2, Cols = 2 
    120  {0x828E, T_BYTE|T_PTR, 4,  (int)&camera_sensor.cfa_pattern}, 
    121  {0xC61A, T_LONG|T_PTR, 1,  (int)&camera_sensor.black_level},     // BlackLevel 
    122  {0xC61D, T_LONG|T_PTR, 1,  (int)&camera_sensor.white_level},     // WhiteLevel 
    123  {0xC61F, T_LONG,       2,  (int)&camera_sensor.crop.origin}, 
    124  {0xC620, T_LONG,       2,  (int)&camera_sensor.crop.size}, 
    125  {0xC68D, T_LONG,       4,  (int)&camera_sensor.dng_active_area}, 
    126  {0, T_END} 
    127 }; 
    128  
    129  
    130 static int cam_shutter[2]       = { 0, 1000000 };       // Shutter speed 
    131 static int cam_aperture[2]      = { 0, 10 };            // Aperture 
    132 static char cam_datetime[20]    = "";                   // DateTimeOriginal 
    133 static int cam_apex_shutter[2]  = { 0, 96 };            // Shutter speed in APEX units 
    134 static int cam_apex_aperture[2] = { 0, 96 };            // Aperture in APEX units 
    135 static int cam_exp_bias[2]      = { 0, 96 }; 
    136 static int cam_max_av[2]        = { 0, 96 }; 
    137 static int cam_focal_length[2]  = { 0, 1000 }; 
    138  
    139 struct dir_entry EXIF_IFD[]={ 
    140  {0x829A, T_RATIONAL,   1,  (int)cam_shutter},          // Shutter speed 
    141  {0x829D, T_RATIONAL,   1,  (int)cam_aperture},         // Aperture 
    142  {0x8822, T_SHORT,      1,  0},                         // ExposureProgram 
    143  {0x8827, T_SHORT|T_PTR,1,  (int)&exif_data.iso},       // ISOSpeedRatings 
    144  {0x9000, T_UNDEFINED,  4,  0x31323230},                // ExifVersion: 2.21 
    145  {0x9003, T_ASCII,      20, (int)cam_datetime},         // DateTimeOriginal 
    146  {0x9201, T_SRATIONAL,  1,  (int)cam_apex_shutter},     // ShutterSpeedValue (APEX units) 
    147  {0x9202, T_RATIONAL,   1,  (int)cam_apex_aperture},    // ApertureValue (APEX units) 
    148  {0x9204, T_SRATIONAL,  1,  (int)cam_exp_bias},         // ExposureBias 
    149  {0x9205, T_RATIONAL,   1,  (int)cam_max_av},           // MaxApertureValue 
    150  {0x9207, T_SHORT,      1,  0},                         // Metering mode 
    151  {0x9209, T_SHORT,      1,  0},                         // Flash mode 
    152  {0x920A, T_RATIONAL,   1,  (int)cam_focal_length},     // FocalLength 
    153  {0xA405, T_SHORT|T_PTR,1,  (int)&exif_data.effective_focal_length},    // FocalLengthIn35mmFilm 
    154  {0, T_END} 
     98// Index of specific entries in ifd0 below. 
     99// *** warning - if entries are added or removed these should be updated *** 
     100#define CAMERA_NAME_INDEX           8       // tag 0x110 
     101#define THUMB_DATA_INDEX            9       // tag 0x111 
     102#define ORIENTATION_INDEX           10      // tag 0x112 
     103#define SUBIFDS_INDEX               17      // tag 0x14A 
     104#define EXIF_IFD_INDEX              19      // tag 0x8769 
     105#define GPS_IFD_INDEX               20      // tag 0x8825 
     106#define DNG_VERSION_INDEX           22      // tag 0xC612 
     107#define UNIQUE_CAMERA_MODEL_INDEX   23      // tag 0xC614 
     108 
     109struct dir_entry ifd0[]={ 
     110    {0xFE,   T_LONG,       1,  1},                                 // NewSubFileType: Preview Image 
     111    {0x100,  T_LONG,       1,  DNG_TH_WIDTH},                      // ImageWidth 
     112    {0x101,  T_LONG,       1,  DNG_TH_HEIGHT},                     // ImageLength 
     113    {0x102,  T_SHORT,      3,  (int)cam_PreviewBitsPerSample},     // BitsPerSample: 8,8,8 
     114    {0x103,  T_SHORT,      1,  1},                                 // Compression: Uncompressed 
     115    {0x106,  T_SHORT,      1,  2},                                 // PhotometricInterpretation: RGB 
     116    {0x10E,  T_ASCII,      1,  0},                                 // ImageDescription 
     117    {0x10F,  T_ASCII,      sizeof(CAM_MAKE), (int)CAM_MAKE},       // Make 
     118    {0x110,  T_ASCII,      32, (int)cam_name},                     // Model: Filled at header generation. 
     119    {0x111,  T_LONG,       1,  0},                                 // StripOffsets: Offset 
     120    {0x112,  T_SHORT,      1,  1},                                 // Orientation: 1 - 0th row is top, 0th column is left 
     121    {0x115,  T_SHORT,      1,  3},                                 // SamplesPerPixel: 3 
     122    {0x116,  T_SHORT,      1,  DNG_TH_HEIGHT},                     // RowsPerStrip 
     123    {0x117,  T_LONG,       1,  DNG_TH_WIDTH*DNG_TH_HEIGHT*3},      // StripByteCounts = preview size 
     124    {0x11C,  T_SHORT,      1,  1},                                 // PlanarConfiguration: 1 
     125    {0x131,  T_ASCII,      sizeof(cam_chdk_ver), (int)cam_chdk_ver},//Software 
     126    {0x132,  T_ASCII,      20, (int)cam_datetime},                 // DateTime 
     127    {0x14A,  T_LONG,       1,  0},                                 // SubIFDs offset 
     128    {0x8298, T_ASCII,      1,  0},                                 // Copyright 
     129    {0x8769, T_LONG,       1,  0},                                 // EXIF_IFD offset 
     130    {0x8825, T_LONG,       1,  0},                                 // GPS_IFD offset 
     131    {0x9216, T_BYTE,       4,  0x00000001},                        // TIFF/EPStandardID: 1.0.0.0 
     132    {0xC612, T_BYTE,       4,  0x00000301},                        // DNGVersion: 1.3.0.0 
     133    {0xC614, T_ASCII,      32, (int)cam_name},                     // UniqueCameraModel. Filled at header generation. 
     134    {0xC621, T_SRATIONAL,  9,  (int)&camera_sensor.color_matrix1}, 
     135    {0xC627, T_RATIONAL,   3,  (int)cam_AnalogBalance}, 
     136    {0xC628, T_RATIONAL,   3,  (int)cam_AsShotNeutral}, 
     137    {0xC62A, T_SRATIONAL,  1,  (int)&camera_sensor.exposure_bias}, 
     138    {0xC62B, T_RATIONAL,   1,  (int)cam_BaselineNoise}, 
     139    {0xC62C, T_RATIONAL,   1,  (int)cam_BaselineSharpness}, 
     140    {0xC62E, T_RATIONAL,   1,  (int)cam_LinearResponseLimit}, 
     141    {0xC630, T_RATIONAL,   4,  (int)&camera_sensor.lens_info}, 
     142    {0xC65A, T_SHORT|T_PTR,1,  (int)&camera_sensor.calibration_illuminant1},  
     143}; 
     144 
     145// Index of specific entries in ifd1 below. 
     146// *** warning - if entries are added or removed these should be updated *** 
     147#define RAW_DATA_INDEX              6       // tag 0x111 
     148#define BADPIXEL_OPCODE_INDEX       21      // tag 0xC740 
     149 
     150struct dir_entry ifd1[]={ 
     151    {0xFE,   T_LONG,       1,  0},                                 // NewSubFileType: Main Image 
     152    {0x100,  T_LONG|T_PTR, 1,  (int)&camera_sensor.raw_rowpix},    // ImageWidth 
     153    {0x101,  T_LONG|T_PTR, 1,  (int)&camera_sensor.raw_rows},      // ImageLength 
     154    {0x102,  T_SHORT|T_PTR,1,  (int)&camera_sensor.bits_per_pixel},// BitsPerSample 
     155    {0x103,  T_SHORT,      1,  1},                                 // Compression: Uncompressed 
     156    {0x106,  T_SHORT,      1,  0x8023},                            //PhotometricInterpretation: CFA 
     157    {0x111,  T_LONG,       1,  0},                                 //StripOffsets: Offset 
     158    {0x115,  T_SHORT,      1,  1},                                 // SamplesPerPixel: 1 
     159    {0x116,  T_SHORT|T_PTR,1,  (int)&camera_sensor.raw_rows},      //RowsPerStrip 
     160    {0x117,  T_LONG|T_PTR, 1,  (int)&camera_sensor.raw_size},      // StripByteCounts = CHDK RAW size 
     161    {0x11A,  T_RATIONAL,   1,  (int)cam_Resolution},               // XResolution 
     162    {0x11B,  T_RATIONAL,   1,  (int)cam_Resolution},               // YResolution 
     163    {0x11C,  T_SHORT,      1,  1},                                 // PlanarConfiguration: 1 
     164    {0x128,  T_SHORT,      1,  2},                                 // ResolutionUnit: inch 
     165    {0x828D, T_SHORT,      2,  0x00020002},                        // CFARepeatPatternDim: Rows = 2, Cols = 2 
     166    {0x828E, T_BYTE|T_PTR, 4,  (int)&camera_sensor.cfa_pattern}, 
     167    {0xC61A, T_LONG|T_PTR, 1,  (int)&camera_sensor.black_level},   // BlackLevel 
     168    {0xC61D, T_LONG|T_PTR, 1,  (int)&camera_sensor.white_level},   // WhiteLevel 
     169    {0xC61F, T_LONG,       2,  (int)&camera_sensor.crop.origin}, 
     170    {0xC620, T_LONG,       2,  (int)&camera_sensor.crop.size}, 
     171    {0xC68D, T_LONG,       4,  (int)&camera_sensor.dng_active_area}, 
     172    {0xC740, T_UNDEFINED|T_PTR, sizeof(badpixel_opcode),  (int)&badpixel_opcode}, 
     173}; 
     174 
     175// Index of specific entries in exif_ifd below. 
     176// *** warning - if entries are added or removed these should be updated *** 
     177#define EXPOSURE_PROGRAM_INDEX      2       // tag 0x8822 
     178#define METERING_MODE_INDEX         10      // tag 0x9207 
     179#define FLASH_MODE_INDEX            11      // tag 0x9209 
     180 
     181struct dir_entry exif_ifd[]={ 
     182    {0x829A, T_RATIONAL,   1,  (int)cam_shutter},          // Shutter speed 
     183    {0x829D, T_RATIONAL,   1,  (int)cam_aperture},         // Aperture 
     184    {0x8822, T_SHORT,      1,  0},                         // ExposureProgram 
     185    {0x8827, T_SHORT|T_PTR,1,  (int)&exif_data.iso},       // ISOSpeedRatings 
     186    {0x9000, T_UNDEFINED,  4,  0x31323230},                // ExifVersion: 2.21 
     187    {0x9003, T_ASCII,      20, (int)cam_datetime},         // DateTimeOriginal 
     188    {0x9201, T_SRATIONAL,  1,  (int)cam_apex_shutter},     // ShutterSpeedValue (APEX units) 
     189    {0x9202, T_RATIONAL,   1,  (int)cam_apex_aperture},    // ApertureValue (APEX units) 
     190    {0x9204, T_SRATIONAL,  1,  (int)cam_exp_bias},         // ExposureBias 
     191    {0x9205, T_RATIONAL,   1,  (int)cam_max_av},           // MaxApertureValue 
     192    {0x9207, T_SHORT,      1,  0},                         // Metering mode 
     193    {0x9209, T_SHORT,      1,  0},                         // Flash mode 
     194    {0x920A, T_RATIONAL,   1,  (int)cam_focal_length},     // FocalLength 
     195    {0xA405, T_SHORT|T_PTR,1,  (int)&exif_data.effective_focal_length},    // FocalLengthIn35mmFilm 
    155196}; 
    156197 
    157198tGPS gps_data; 
    158199 
    159 struct dir_entry GPS_IFD[]={ 
    160   {0x0000, T_BYTE,              4,  0x00000302},                    //GPSVersionID: 2 3 0 0 
    161   {0x0001, T_ASCII,             2,  (int)gps_data.latitudeRef},     //North or South Latitude "N\0" or "S\0" 
    162   {0x0002, T_RATIONAL,          3,  (int)gps_data.latitude},        //Latitude 
    163   {0x0003, T_ASCII,             2,  (int)gps_data.longitudeRef},    //East or West Latitude "E\0" or "W\0" 
    164   {0x0004, T_RATIONAL,          3,  (int)gps_data.longitude},       //Longitude 
    165   {0x0005, T_BYTE,              1,  (int)gps_data.heightRef},       //AltitudeRef 
    166   {0x0006, T_RATIONAL,          1,  (int)gps_data.height},          //Altitude 
    167   {0x0007, T_RATIONAL,          3,  (int)gps_data.timeStamp},       //TimeStamp 
    168   {0x0009, T_ASCII,             2,  (int)gps_data.status},          //Status 
    169 //{0x000A, T_ASCII,             1,  0},                             //MeasureMode 
    170   {0x0012, T_ASCII,             7,  (int)gps_data.mapDatum},        //MapDatum 7 + 1 pad byte 
    171   {0x001D, T_ASCII,             11, (int)gps_data.dateStamp},       //DateStamp 11 + 1 pad byte 
    172   {0, T_END} 
    173 }; 
    174  
    175  
    176 int get_type_size(int type){ 
    177  switch(type & 0xFF){ 
    178   case T_BYTE: 
    179   case T_SBYTE: 
    180   case T_UNDEFINED: 
    181   case T_ASCII:     return 1;  
    182   case T_SHORT: 
    183   case T_SSHORT:    return 2; 
    184   case T_LONG: 
    185   case T_SLONG: 
    186   case T_FLOAT:     return 4; 
    187   case T_RATIONAL: 
    188   case T_SRATIONAL: 
    189   case T_DOUBLE:    return 8; 
    190   default:          return 0; 
    191  } 
    192 } 
    193  
    194 struct {struct dir_entry* entry; int count;} IFD_LIST[]={{IFD0,0}, {IFD1,0}, {EXIF_IFD,0}, {GPS_IFD, 0}}; 
    195  
    196 #define IFDs (sizeof(IFD_LIST)/sizeof(IFD_LIST[0])) 
     200struct dir_entry gpd_ifd[]={ 
     201    {0x0000, T_BYTE,              4,  0x00000302},                    //GPSVersionID: 2 3 0 0 
     202    {0x0001, T_ASCII|T_PTR,       2,  (int)gps_data.latitudeRef},     //North or South Latitude "N\0" or "S\0" 
     203    {0x0002, T_RATIONAL,          3,  (int)gps_data.latitude},        //Latitude 
     204    {0x0003, T_ASCII|T_PTR,       2,  (int)gps_data.longitudeRef},    //East or West Latitude "E\0" or "W\0" 
     205    {0x0004, T_RATIONAL,          3,  (int)gps_data.longitude},       //Longitude 
     206    {0x0005, T_BYTE|T_PTR,        1,  (int)&gps_data.heightRef},      //AltitudeRef 
     207    {0x0006, T_RATIONAL,          1,  (int)gps_data.height},          //Altitude 
     208    {0x0007, T_RATIONAL,          3,  (int)gps_data.timeStamp},       //TimeStamp 
     209    {0x0009, T_ASCII|T_PTR,       2,  (int)gps_data.status},          //Status 
     210    //{0x000A, T_ASCII,             1,  0},                             //MeasureMode 
     211    {0x0012, T_ASCII,             7,  (int)gps_data.mapDatum},        //MapDatum 7 + 1 pad byte 
     212    {0x001D, T_ASCII,             11, (int)gps_data.dateStamp},       //DateStamp 11 + 1 pad byte 
     213}; 
     214 
     215int get_type_size(int type) 
     216{ 
     217    switch(type & 0xFF) 
     218    { 
     219    case T_BYTE: 
     220    case T_SBYTE: 
     221    case T_UNDEFINED: 
     222    case T_ASCII:     return 1;  
     223    case T_SHORT: 
     224    case T_SSHORT:    return 2; 
     225    case T_LONG: 
     226    case T_SLONG: 
     227    case T_FLOAT:     return 4; 
     228    case T_RATIONAL: 
     229    case T_SRATIONAL: 
     230    case T_DOUBLE:    return 8; 
     231    default:          return 0; 
     232    } 
     233} 
     234 
     235#define DIR_SIZE(ifd)   (sizeof(ifd)/sizeof(ifd[0])) 
     236 
     237struct 
     238{ 
     239    struct dir_entry* entry; 
     240    int count;                  // Number of entries to be saved 
     241    int entry_count;            // Total number of entries 
     242} ifd_list[] =  
     243{ 
     244    {ifd0,      DIR_SIZE(ifd0),     DIR_SIZE(ifd0)},  
     245    {ifd1,      DIR_SIZE(ifd1),     DIR_SIZE(ifd1)},  
     246    {exif_ifd,  DIR_SIZE(exif_ifd), DIR_SIZE(exif_ifd)},  
     247    {gpd_ifd,   DIR_SIZE(gpd_ifd),  DIR_SIZE(gpd_ifd)} 
     248}; 
    197249 
    198250#define TIFF_HDR_SIZE (8) 
     
    205257void add_to_buf(void* var, int size) 
    206258{ 
    207  memcpy(dng_header_buf+dng_header_buf_offset,var,size); 
    208  dng_header_buf_offset+=size; 
     259    memcpy(dng_header_buf+dng_header_buf_offset,var,size); 
     260    dng_header_buf_offset += size; 
     261} 
     262 
     263void add_val_to_buf(int val, int size) 
     264{ 
     265    add_to_buf(&val,size); 
    209266} 
    210267 
    211268void create_dng_header(){ 
    212  int var; 
    213  int i,j; 
    214  int extra_offset; 
    215  int raw_offset; 
    216  
    217  // filling EXIF fields 
    218  
    219  gps_getData(&gps_data);  
    220  
    221  for (j=0;j<IFDs;j++) { 
    222   for(i=0; IFD_LIST[j].entry[i].type; i++) { 
    223     switch (IFD_LIST[j].entry[i].tag) { 
    224      // For camera name string make sure the 'count' in the IFD header is correct for the string 
    225      case 0x110 :                                                                                       // CameraName 
    226      case 0xC614: IFD_LIST[j].entry[i].count = strlen((char*)IFD_LIST[j].entry[i].offset) + 1; break;   // UniqueCameraModel 
    227      case 0x132 : 
    228      case 0x8822: IFD_LIST[j].entry[i].offset=get_exp_program_for_exif(exif_data.exp_program); break;//ExposureProgram 
    229      case 0x0112: IFD_LIST[j].entry[i].offset=get_orientation_for_exif(exif_data.orientation); break; //Orientation 
    230      case 0x9209: IFD_LIST[j].entry[i].offset=get_flash_mode_for_exif(exif_data.flash_mode, exif_data.flash_fired); break; //Flash mode 
    231      case 0x9207: IFD_LIST[j].entry[i].offset=get_metering_mode_for_exif(exif_data.metering_mode); break; // Metering mode 
    232     } 
    233   } 
    234  } 
    235    
    236  // calculating offset of RAW data and count of directories for each IFD 
    237  
    238  raw_offset=TIFF_HDR_SIZE; 
    239  
    240  for (j=0;j<IFDs;j++) { 
    241   IFD_LIST[j].count=0; 
    242   raw_offset+=6; // IFD header+footer 
    243   for(i=0; IFD_LIST[j].entry[i].type; i++) { 
    244    int size_ext; 
    245    IFD_LIST[j].count++; 
    246    raw_offset+=12; // IFD directory size 
    247    size_ext=get_type_size(IFD_LIST[j].entry[i].type)*IFD_LIST[j].entry[i].count; 
    248    if (size_ext>4) raw_offset+=size_ext+(size_ext&1); 
    249   } 
    250  } 
    251  
    252  // creating buffer for writing data 
    253  raw_offset=(raw_offset/512+1)*512; // exlusively for CHDK fast file writing 
    254  dng_header_buf_size=raw_offset; 
    255  dng_header_buf=umalloc(raw_offset); 
    256  dng_header_buf_offset=0; 
    257  if (!dng_header_buf) return; 
    258  
    259  // create buffer for thumbnail 
    260  thumbnail_buf = malloc(DNG_TH_WIDTH*DNG_TH_HEIGHT*3); 
    261  if (!thumbnail_buf) 
    262  { 
    263      ufree(dng_header_buf); 
    264      dng_header_buf = 0; 
    265      return; 
    266  } 
    267  
    268  //  writing  offsets for EXIF IFD and RAW data and calculating offset for extra data 
    269  
    270  extra_offset=TIFF_HDR_SIZE; 
    271  
    272  for (j=0;j<IFDs;j++) { 
    273   extra_offset+=6+IFD_LIST[j].count*12; // IFD header+footer 
    274   for(i=0; IFD_LIST[j].entry[i].type; i++) { 
    275    if (IFD_LIST[j].entry[i].tag==0x8769) IFD_LIST[j].entry[i].offset=TIFF_HDR_SIZE+(IFD_LIST[0].count+IFD_LIST[1].count)*12+6+6;  // EXIF IFD offset 
    276    if (IFD_LIST[j].entry[i].tag==0x8825) IFD_LIST[j].entry[i].offset=TIFF_HDR_SIZE+(IFD_LIST[0].count+IFD_LIST[1].count+IFD_LIST[2].count)*12+6+6+6;  // GPS IFD offset 
    277    if (IFD_LIST[j].entry[i].tag==0x14A)  IFD_LIST[j].entry[i].offset=TIFF_HDR_SIZE+IFD_LIST[0].count*12+6; // SubIFDs offset 
    278    if (IFD_LIST[j].entry[i].tag==0x111)  { 
    279     if (j==1) IFD_LIST[j].entry[i].offset=raw_offset+DNG_TH_WIDTH*DNG_TH_HEIGHT*3;  //StripOffsets for main image 
    280     if (j==0) IFD_LIST[j].entry[i].offset=raw_offset;  //StripOffsets for thumbnail 
    281    } 
    282   } 
    283  } 
    284  
    285  // TIFF file header 
    286  
    287  var=0x4949; // little endian 
    288  add_to_buf(&var, sizeof(short)); 
    289  var=42; //An arbitrary but carefully chosen number that further identifies the file as a TIFF file. 
    290  add_to_buf(&var, sizeof(short)); 
    291  var=0x8; // offset of first IFD 
    292  add_to_buf(&var, sizeof(int)); 
    293  
    294  
    295  // writing IFDs 
    296  
    297  for (j=0;j<IFDs;j++) { 
    298   int size_ext; 
    299   var=IFD_LIST[j].count; 
    300   add_to_buf(&var, sizeof(short)); 
    301   for(i=0; IFD_LIST[j].entry[i].type; i++) { 
    302     add_to_buf(&IFD_LIST[j].entry[i].tag, sizeof(short)); 
    303     unsigned short t = IFD_LIST[j].entry[i].type & 0xFF; 
    304     add_to_buf(&t, sizeof(short)); 
    305     add_to_buf(&IFD_LIST[j].entry[i].count, sizeof(int)); 
    306     size_ext=get_type_size(IFD_LIST[j].entry[i].type)*IFD_LIST[j].entry[i].count; 
    307     if (size_ext<=4)  
    308     { 
    309         if (IFD_LIST[j].entry[i].type & T_PTR) 
     269    int i,j; 
     270    int extra_offset; 
     271    int raw_offset; 
     272 
     273    // Set version and opcodes 
     274    if (conf.dng_version) 
     275    { 
     276        // If CHDK is removing bad pixels then set DNG version to 1.1 and remove opcodes 
     277        ifd0[DNG_VERSION_INDEX].offset = BE(0x01010000); 
     278        ifd1[BADPIXEL_OPCODE_INDEX].type |= T_SKIP; 
     279        ifd_list[1].count = DIR_SIZE(ifd1) - 1; 
     280    } 
     281    else 
     282    { 
     283        // Set DNG version to 1.3 and add bad pixel opcodes 
     284        ifd0[DNG_VERSION_INDEX].offset = BE(0x01030000); 
     285        ifd1[BADPIXEL_OPCODE_INDEX].type &= ~T_SKIP; 
     286        ifd_list[1].count = DIR_SIZE(ifd1); 
     287    } 
     288 
     289    // filling EXIF fields 
     290 
     291    int ifd_count = DIR_SIZE(ifd_list); 
     292 
     293    if (camera_info.props.gps) 
     294    { 
     295        // If camera has GPS get the GPS data 
     296        gps_getData(&gps_data);  
     297    } 
     298    else 
     299    { 
     300        // If no GPS then remove the GPS data from the header - assumes gps_ifd is the last one in ifd_list 
     301        ifd_count--; 
     302        ifd_list[0].count = DIR_SIZE(ifd0) - 1;     // Entry 0x8825 won't be saved so don't count it 
     303        ifd0[GPS_IFD_INDEX].type |= T_SKIP;         // mark entry so it is skipped 
     304    } 
     305 
     306    // Fix the counts and offsets where needed 
     307 
     308    ifd0[CAMERA_NAME_INDEX].count = ifd0[UNIQUE_CAMERA_MODEL_INDEX].count = strlen(cam_name) + 1; 
     309    ifd0[ORIENTATION_INDEX].offset = get_orientation_for_exif(exif_data.orientation); 
     310 
     311    exif_ifd[EXPOSURE_PROGRAM_INDEX].offset = get_exp_program_for_exif(exif_data.exp_program); 
     312    exif_ifd[METERING_MODE_INDEX].offset = get_metering_mode_for_exif(exif_data.metering_mode); 
     313    exif_ifd[FLASH_MODE_INDEX].offset = get_flash_mode_for_exif(exif_data.flash_mode, exif_data.flash_fired); 
     314 
     315    // calculating offset of RAW data and count of entries for each IFD 
     316    raw_offset=TIFF_HDR_SIZE; 
     317 
     318    for (j=0;j<ifd_count;j++) 
     319    { 
     320        raw_offset+=6; // IFD header+footer 
     321        for(i=0; i<ifd_list[j].entry_count; i++) 
    310322        { 
    311             add_to_buf((void*)IFD_LIST[j].entry[i].offset, sizeof(int)); 
     323            if ((ifd_list[j].entry[i].type & T_SKIP) == 0)  // Exclude skipped entries (e.g. GPS info if camera doesn't have GPS) 
     324            { 
     325                raw_offset+=12; // IFD directory entry size 
     326                int size_ext=get_type_size(ifd_list[j].entry[i].type)*ifd_list[j].entry[i].count; 
     327                if (size_ext>4) raw_offset+=size_ext+(size_ext&1); 
     328            } 
    312329        } 
    313         else 
     330    } 
     331 
     332    // creating buffer for writing data 
     333    raw_offset=(raw_offset/512+1)*512; // exlusively for CHDK fast file writing 
     334    dng_header_buf_size=raw_offset; 
     335    dng_header_buf=umalloc(raw_offset); 
     336    dng_header_buf_offset=0; 
     337    if (!dng_header_buf) return; 
     338 
     339    // create buffer for thumbnail 
     340    thumbnail_buf = malloc(DNG_TH_WIDTH*DNG_TH_HEIGHT*3); 
     341    if (!thumbnail_buf) 
     342    { 
     343        ufree(dng_header_buf); 
     344        dng_header_buf = 0; 
     345        return; 
     346    } 
     347 
     348    //  writing offsets for EXIF IFD and RAW data and calculating offset for extra data 
     349 
     350    extra_offset=TIFF_HDR_SIZE; 
     351 
     352    ifd0[SUBIFDS_INDEX].offset = TIFF_HDR_SIZE + ifd_list[0].count * 12 + 6;                            // SubIFDs offset 
     353    ifd0[EXIF_IFD_INDEX].offset = TIFF_HDR_SIZE + (ifd_list[0].count + ifd_list[1].count) * 12 + 6 + 6; // EXIF IFD offset 
     354    if (camera_info.props.gps) 
     355        ifd0[GPS_IFD_INDEX].offset = TIFF_HDR_SIZE + (ifd_list[0].count + ifd_list[1].count + ifd_list[2].count) * 12 + 6 + 6 + 6;  // GPS IFD offset 
     356 
     357    ifd0[THUMB_DATA_INDEX].offset = raw_offset;                                     //StripOffsets for thumbnail 
     358    ifd1[RAW_DATA_INDEX].offset = raw_offset + DNG_TH_WIDTH * DNG_TH_HEIGHT * 3;    //StripOffsets for main image 
     359 
     360    for (j=0;j<ifd_count;j++) 
     361    { 
     362        extra_offset += 6 + ifd_list[j].count * 12; // IFD header+footer 
     363    } 
     364 
     365    // TIFF file header 
     366 
     367    add_val_to_buf(0x4949, sizeof(short));      // little endian 
     368    add_val_to_buf(42, sizeof(short));          // An arbitrary but carefully chosen number that further identifies the file as a TIFF file. 
     369    add_val_to_buf(TIFF_HDR_SIZE, sizeof(int)); // offset of first IFD 
     370 
     371    // writing IFDs 
     372 
     373    for (j=0;j<ifd_count;j++) 
     374    { 
     375        int size_ext; 
     376        add_val_to_buf(ifd_list[j].count, sizeof(short)); 
     377        for(i=0; i<ifd_list[j].entry_count; i++) 
    314378        { 
    315             add_to_buf(&IFD_LIST[j].entry[i].offset, sizeof(int)); 
     379            if ((ifd_list[j].entry[i].type & T_SKIP) == 0) 
     380            { 
     381                add_val_to_buf(ifd_list[j].entry[i].tag, sizeof(short)); 
     382                add_val_to_buf(ifd_list[j].entry[i].type & 0xFF, sizeof(short)); 
     383                add_val_to_buf(ifd_list[j].entry[i].count, sizeof(int)); 
     384                size_ext=get_type_size(ifd_list[j].entry[i].type)*ifd_list[j].entry[i].count; 
     385                if (size_ext<=4)  
     386                { 
     387                    if (ifd_list[j].entry[i].type & T_PTR) 
     388                    { 
     389                        add_to_buf((void*)ifd_list[j].entry[i].offset, sizeof(int)); 
     390                    } 
     391                    else 
     392                    { 
     393                        add_val_to_buf(ifd_list[j].entry[i].offset, sizeof(int)); 
     394                    } 
     395                } 
     396                else 
     397                { 
     398                    add_val_to_buf(extra_offset, sizeof(int)); 
     399                    extra_offset += size_ext+(size_ext&1);     
     400                } 
     401            } 
    316402        } 
    317     } 
    318     else 
    319     { 
    320         add_to_buf(&extra_offset, sizeof(int)); 
    321         extra_offset+=size_ext+(size_ext&1);     
    322     } 
    323   } 
    324  var=0;  
    325  add_to_buf(&var, sizeof(int)); 
    326  } 
    327  
    328  
    329  // writing extra data 
    330  
    331  for (j=0;j<IFDs;j++) { 
    332   int size_ext; 
    333   char zero=0; 
    334   for(i=0; IFD_LIST[j].entry[i].type; i++) { 
    335    size_ext=get_type_size(IFD_LIST[j].entry[i].type)*IFD_LIST[j].entry[i].count; 
    336    if (size_ext>4){ 
    337     add_to_buf((void*)IFD_LIST[j].entry[i].offset, size_ext); 
    338     if (size_ext&1) add_to_buf(&zero, 1); 
    339    } 
    340   } 
    341  } 
    342  
    343  // writing zeros to tail of dng header (just for fun) 
    344  for (i=dng_header_buf_offset; i<dng_header_buf_size; i++) dng_header_buf[i]=0; 
     403        add_val_to_buf(0, sizeof(int)); 
     404    } 
     405 
     406    // writing extra data 
     407 
     408    for (j=0;j<ifd_count;j++) 
     409    { 
     410        int size_ext; 
     411        for(i=0; i<ifd_list[j].entry_count; i++) 
     412        { 
     413            if ((ifd_list[j].entry[i].type & T_SKIP) == 0) 
     414            { 
     415                size_ext=get_type_size(ifd_list[j].entry[i].type)*ifd_list[j].entry[i].count; 
     416                if (size_ext>4) 
     417                { 
     418                    add_to_buf((void*)ifd_list[j].entry[i].offset, size_ext); 
     419                    if (size_ext&1) add_val_to_buf(0, 1); 
     420                } 
     421            } 
     422        } 
     423    } 
     424 
     425    // writing zeros to tail of dng header (just for fun) 
     426    for (i=dng_header_buf_offset; i<dng_header_buf_size; i++) dng_header_buf[i]=0; 
    345427} 
    346428 
     
    359441} 
    360442 
    361 unsigned short get_exp_program_for_exif(int exp_program){ 
    362  switch(exp_program){ 
    363   case MODE_M: return 1; 
    364   case MODE_P: return 2; 
    365   case MODE_AV: return 3; 
    366   case MODE_TV: return 4; 
    367   default: return 0; 
    368  } 
    369 } 
    370  
    371 unsigned short get_orientation_for_exif(short orientation){ 
    372  switch(orientation){ 
    373   case  90: return 6;  // Right  - Top 
    374   case 180: return 3;  // Bottom - Right 
    375   case 270: return 8;  // Left   - Bottom 
    376   case   0:            // Top    - Left 
    377   default : return 1; 
    378  } 
     443unsigned short get_exp_program_for_exif(int exp_program) 
     444{ 
     445    switch(exp_program) 
     446    { 
     447    case MODE_M: return 1; 
     448    case MODE_P: return 2; 
     449    case MODE_AV: return 3; 
     450    case MODE_TV: return 4; 
     451    default: return 0; 
     452    } 
     453} 
     454 
     455unsigned short get_orientation_for_exif(short orientation) 
     456{ 
     457    switch(orientation) 
     458    { 
     459    case  90: return 6;  // Right  - Top 
     460    case 180: return 3;  // Bottom - Right 
     461    case 270: return 8;  // Left   - Bottom 
     462    case   0:            // Top    - Left 
     463    default : return 1; 
     464    } 
    379465} 
    380466 
    381467unsigned short get_flash_mode_for_exif(short mode, short fired){ 
    382  fired&=1; 
    383  switch(mode){ 
    384   case 0: return (3<<3)|fired; // auto 
    385   case 1: return (1<<3)|fired; // on 
    386   case 2: return (2<<3)|fired; // off 
    387   default: return fired; 
    388  }; 
    389 } 
    390  
    391 unsigned short get_metering_mode_for_exif(short metering_mode){ 
    392  switch (metering_mode){ 
    393   case 0: return 5; // Evaluative 
    394   case 1: return 3; // Spot 
    395   case 2: return 2; // CenterWeightedAverage 
    396   default: return 255; // other 
    397  } 
     468    fired&=1; 
     469    switch(mode) 
     470    { 
     471    case 0: return (3<<3)|fired; // auto 
     472    case 1: return (1<<3)|fired; // on 
     473    case 2: return (2<<3)|fired; // off 
     474    default: return fired; 
     475    }; 
     476} 
     477 
     478unsigned short get_metering_mode_for_exif(short metering_mode) 
     479{ 
     480    switch (metering_mode) 
     481    { 
     482    case 0: return 5; // Evaluative 
     483    case 1: return 3; // Spot 
     484    case 2: return 2; // CenterWeightedAverage 
     485    default: return 255; // other 
     486    } 
    398487} 
    399488 
    400489void capture_data_for_exif(void) 
    401490{ 
    402  short short_prop_val; 
    403  time_t datetime; 
    404  struct tm *ttm; 
    405  extern volatile long shutter_open_time; // defined in platform/generic/capt_seq.c 
    406  int wb[3]; 
    407  
    408  exif_data.iso=shooting_get_iso_market(); 
    409  
    410  // Shutter speed tags 
    411  get_property_case(camera_info.props.tv, &short_prop_val, sizeof(short_prop_val)); 
    412  cam_shutter[0]      = pow_calc( 1000000, 2, 1, -short_prop_val, 96); 
    413  cam_apex_shutter[0] = short_prop_val; 
    414  
    415  // Date & time tag (note - uses shutter speed from 'short_prop_val' code above) 
    416  if (shutter_open_time) { datetime = shutter_open_time + pow_calc(1, 2, 1, -short_prop_val, 96); shutter_open_time=0;} // shutter closing time 
    417  else  datetime = time(NULL); 
    418  ttm = localtime(&datetime); 
    419  sprintf(cam_datetime, "%04d:%02d:%02d %02d:%02d:%02d", ttm->tm_year+1900, ttm->tm_mon+1, ttm->tm_mday, ttm->tm_hour, ttm->tm_min, ttm->tm_sec); 
    420  
    421  get_property_case(camera_info.props.av, &short_prop_val, sizeof(short_prop_val)); 
    422  cam_aperture[0]      = pow_calc( 10, 2, 1, short_prop_val, 192); 
    423  cam_apex_aperture[0] = short_prop_val; 
    424  
    425  get_property_case(camera_info.props.min_av, &short_prop_val, sizeof(short_prop_val)); 
    426  cam_max_av[0] = short_prop_val; 
    427  
    428  get_property_case(camera_info.props.ev_correction_2, &short_prop_val, sizeof(short_prop_val)); 
    429  cam_exp_bias[0] = short_prop_val; 
    430  
    431  exif_data.exp_program=mode_get() & MODE_SHOOTING_MASK; 
    432  
    433  cam_focal_length[0] = get_focal_length(shooting_get_zoom()); 
    434  exif_data.effective_focal_length = get_effective_focal_length(shooting_get_zoom()) / 1000; 
    435  
    436  get_property_case(camera_info.props.orientation_sensor, &exif_data.orientation, sizeof(exif_data.orientation)); 
    437  get_parameter_data(camera_info.params.camera_name, &cam_name, sizeof(cam_name)); 
    438  get_property_case(camera_info.props.flash_mode, &exif_data.flash_mode, sizeof(exif_data.flash_mode)); 
    439  get_property_case(camera_info.props.flash_fire, &exif_data.flash_fired, sizeof(exif_data.flash_fired)); 
    440  get_property_case(camera_info.props.metering_mode, &exif_data.metering_mode, sizeof(exif_data.metering_mode)); 
    441  
    442  get_property_case(camera_info.props.wb_adj, &wb, sizeof(wb));   
    443  cam_AsShotNeutral[1]=wb[1]; 
    444  cam_AsShotNeutral[3]=wb[0]; 
    445  cam_AsShotNeutral[5]=wb[2]; 
     491    short short_prop_val; 
     492    time_t datetime; 
     493    struct tm *ttm; 
     494    extern volatile long shutter_open_time; // defined in platform/generic/capt_seq.c 
     495    int wb[3]; 
     496 
     497    exif_data.iso=shooting_get_iso_market(); 
     498 
     499    // Shutter speed tags 
     500    get_property_case(camera_info.props.tv, &short_prop_val, sizeof(short_prop_val)); 
     501    cam_shutter[0]      = pow_calc( 1000000, 2, 1, -short_prop_val, 96); 
     502    cam_apex_shutter[0] = short_prop_val; 
     503 
     504    // Date & time tag (note - uses shutter speed from 'short_prop_val' code above) 
     505    if (shutter_open_time) { datetime = shutter_open_time + pow_calc(1, 2, 1, -short_prop_val, 96); shutter_open_time=0;} // shutter closing time 
     506    else  datetime = time(NULL); 
     507    ttm = localtime(&datetime); 
     508    sprintf(cam_datetime, "%04d:%02d:%02d %02d:%02d:%02d", ttm->tm_year+1900, ttm->tm_mon+1, ttm->tm_mday, ttm->tm_hour, ttm->tm_min, ttm->tm_sec); 
     509 
     510    get_property_case(camera_info.props.av, &short_prop_val, sizeof(short_prop_val)); 
     511    cam_aperture[0]      = pow_calc( 10, 2, 1, short_prop_val, 192); 
     512    cam_apex_aperture[0] = short_prop_val; 
     513 
     514    get_property_case(camera_info.props.min_av, &short_prop_val, sizeof(short_prop_val)); 
     515    cam_max_av[0] = short_prop_val; 
     516 
     517    get_property_case(camera_info.props.ev_correction_2, &short_prop_val, sizeof(short_prop_val)); 
     518    cam_exp_bias[0] = short_prop_val; 
     519 
     520    exif_data.exp_program=mode_get() & MODE_SHOOTING_MASK; 
     521 
     522    cam_focal_length[0] = get_focal_length(shooting_get_zoom()); 
     523    exif_data.effective_focal_length = get_effective_focal_length(shooting_get_zoom()) / 1000; 
     524 
     525    get_property_case(camera_info.props.orientation_sensor, &exif_data.orientation, sizeof(exif_data.orientation)); 
     526    get_parameter_data(camera_info.params.camera_name, &cam_name, sizeof(cam_name)); 
     527    get_property_case(camera_info.props.flash_mode, &exif_data.flash_mode, sizeof(exif_data.flash_mode)); 
     528    get_property_case(camera_info.props.flash_fire, &exif_data.flash_fired, sizeof(exif_data.flash_fired)); 
     529    get_property_case(camera_info.props.metering_mode, &exif_data.metering_mode, sizeof(exif_data.metering_mode)); 
     530 
     531    get_property_case(camera_info.props.wb_adj, &wb, sizeof(wb));   
     532    cam_AsShotNeutral[1]=wb[1]; 
     533    cam_AsShotNeutral[3]=wb[0]; 
     534    cam_AsShotNeutral[5]=wb[2]; 
    446535} 
    447536 
    448537//------------------------------------------------------------------- 
    449538 
    450 void convert_dng_to_chdk_raw(char* fn){ 
    451  #define BUF_SIZE (32768) 
    452  FILE *dng, *raw; 
    453  int *buf; 
    454  int i; 
    455  struct STD_stat st; 
    456  struct utimbuf t; 
    457  
    458  if (safe_stat(fn, &st) != 0 || st.st_size<=camera_sensor.raw_size)  return; 
    459  buf=malloc(BUF_SIZE); 
    460  if (buf){ 
    461   started(); 
    462   dng=fopen(fn,"rb"); 
    463   if (dng){ 
    464    fread(buf, 1, 8, dng); 
    465    if (buf[0]==0x2A4949 && buf[1]==8) {  // chdk dng header 
    466     i=strlen(fn)-3; 
    467     if (strncmp(fn+i,"CR",2)==0) strcpy(fn+i,"WAV"); else strcpy(fn+i,"CRW"); 
    468     raw=fopen(fn,"w+b"); 
    469     if (raw){ 
    470      fseek(dng, st.st_size-camera_sensor.raw_size, SEEK_SET); // SEEK_END is not working? 
    471      for (i=0; i<camera_sensor.raw_size/BUF_SIZE; i++) { 
    472       fread(buf, 1, BUF_SIZE, dng); 
    473       reverse_bytes_order((char*)buf, BUF_SIZE); 
    474       fwrite(buf, 1, BUF_SIZE, raw); 
    475      } 
    476      fread(buf, 1, camera_sensor.raw_size%BUF_SIZE, dng); 
    477      reverse_bytes_order((char*)buf, camera_sensor.raw_size%BUF_SIZE); 
    478      fwrite(buf, 1, camera_sensor.raw_size%BUF_SIZE, raw); 
    479      fclose(raw); 
    480      t.actime = t.modtime = time(NULL); 
    481      utime(fn, &t); 
    482     } // if (raw) 
    483    } // if chdk dng header 
    484   fclose(dng); 
    485   } //if (dng) 
    486  free(buf); 
    487  finished(); 
    488  }  //if (buf) 
     539void convert_dng_to_chdk_raw(char* fn) 
     540{ 
     541#define BUF_SIZE (32768) 
     542    FILE *dng, *raw; 
     543    int *buf; 
     544    int i; 
     545    struct STD_stat st; 
     546    struct utimbuf t; 
     547 
     548    if (safe_stat(fn, &st) != 0 || st.st_size<=camera_sensor.raw_size)  return; 
     549    buf=malloc(BUF_SIZE); 
     550    if (buf) 
     551    { 
     552        started(); 
     553        dng=fopen(fn,"rb"); 
     554        if (dng) 
     555        { 
     556            fread(buf, 1, 8, dng); 
     557            if (buf[0]==0x2A4949 && buf[1]==8) 
     558            {  // chdk dng header 
     559                i=strlen(fn)-3; 
     560                if (strncmp(fn+i,"CR",2)==0) strcpy(fn+i,"WAV"); else strcpy(fn+i,"CRW"); 
     561                raw=fopen(fn,"w+b"); 
     562                if (raw){ 
     563                    fseek(dng, st.st_size-camera_sensor.raw_size, SEEK_SET); // SEEK_END is not working? 
     564                    for (i=0; i<camera_sensor.raw_size/BUF_SIZE; i++) 
     565                    { 
     566                        fread(buf, 1, BUF_SIZE, dng); 
     567                        reverse_bytes_order((char*)buf, BUF_SIZE); 
     568                        fwrite(buf, 1, BUF_SIZE, raw); 
     569                    } 
     570                    fread(buf, 1, camera_sensor.raw_size%BUF_SIZE, dng); 
     571                    reverse_bytes_order((char*)buf, camera_sensor.raw_size%BUF_SIZE); 
     572                    fwrite(buf, 1, camera_sensor.raw_size%BUF_SIZE, raw); 
     573                    fclose(raw); 
     574                    t.actime = t.modtime = time(NULL); 
     575                    utime(fn, &t); 
     576                } // if (raw) 
     577            } // if chdk dng header 
     578            fclose(dng); 
     579        } //if (dng) 
     580        free(buf); 
     581        finished(); 
     582    }  //if (buf) 
    489583} 
    490584 
     
    494588static unsigned char gamma[256]; 
    495589 
    496 void fill_gamma_buf(void) { 
     590void fill_gamma_buf(void) 
     591{ 
    497592    int i; 
    498593    if (gamma[255]) return; 
     
    502597} 
    503598 
    504 void create_thumbnail() { 
     599void create_thumbnail() 
     600{ 
    505601    register int i, j, x, y, yadj, xadj; 
    506602    register char *buf = thumbnail_buf; 
     
    541637int init_badpixel_bin_flag; // contants above to count/create file, > 0 num bad pixel 
    542638 
    543 int raw_init_badpixel_bin() { 
     639int raw_init_badpixel_bin() 
     640{ 
    544641    int count; 
    545642    unsigned short c[2]; 
    546643    FILE*f; 
    547     if(init_badpixel_bin_flag == INIT_BADPIXEL_FILE) { 
     644    if(init_badpixel_bin_flag == INIT_BADPIXEL_FILE) 
     645    { 
    548646        f=fopen(PATH_BAD_TMP_BIN,"w+b"); 
    549     } else if (init_badpixel_bin_flag == INIT_BADPIXEL_COUNT) { 
     647    } 
     648    else if (init_badpixel_bin_flag == INIT_BADPIXEL_COUNT) 
     649    { 
    550650        f=NULL; 
    551     } else { 
     651    } 
     652    else 
     653    { 
    552654        return 0; 
    553655    } 
     
    579681int binary_count=-1; 
    580682 
    581 void load_bad_pixels_list_b(char* filename) { 
     683void load_bad_pixels_list_b(char* filename) 
     684{ 
    582685    struct STD_stat st; 
    583686    long filesize; 
     
    585688    FILE *fd; 
    586689 
    587         if ( filename==0 ) 
    588          { unload_bad_pixels_list_b(); return; } 
     690    if ( filename==0 ) 
     691    {  
     692        unload_bad_pixels_list_b(); 
     693        return; 
     694    } 
    589695 
    590696    binary_count=-1; 
     
    592698    filesize=st.st_size; 
    593699    if (filesize%(2*sizeof(short)) != 0) return; 
    594         if (filesize == 0) { binary_count = 0; return; }        // Allow empty badpixel.bin file 
     700    if (filesize == 0) { binary_count = 0; return; }    // Allow empty badpixel.bin file 
    595701    ptr=malloc(filesize); 
    596702    if (!ptr) return; 
    597703    fd=fopen(filename, "rb"); 
    598     if (fd) { 
     704    if (fd) 
     705    { 
    599706        fread(ptr,1, filesize,fd); 
    600707        fclose(fd); 
     
    605712} 
    606713 
    607 void unload_bad_pixels_list_b(void) { 
     714void unload_bad_pixels_list_b(void) 
     715{ 
    608716    if (binary_list) free(binary_list); 
    609717    binary_list=NULL; 
     
    611719} 
    612720 
    613 void patch_bad_pixels_b(void) { 
     721void patch_bad_pixels_b(void) 
     722{ 
    614723    int i; 
    615724    short* ptr=binary_list; 
     
    626735 
    627736int badpixel_list_loaded_b(void) { 
    628         return (binary_count >= 0) ? 1 : 0; 
     737    return (binary_count >= 0) ? 1 : 0; 
    629738} 
    630739 
     
    637746}; 
    638747 
    639 int badpixel_task_stack(long p) { 
     748int badpixel_task_stack(long p) 
     749{ 
    640750    static unsigned int badpix_cnt1; 
    641751 
    642     switch(p) { 
    643         case BADPIX_START: 
    644             action_pop(); 
    645  
    646             console_clear(); 
    647             console_add_line("Wait please... "); 
    648             console_add_line("This takes a few seconds,"); 
    649             console_add_line("don't panic!"); 
    650  
    651             init_badpixel_bin_flag = INIT_BADPIXEL_COUNT; 
    652  
    653             shooting_set_tv96_direct(96, SET_LATER); 
    654             action_push(BADPIX_S1); 
    655             action_push(AS_SHOOT); 
    656             action_push_delay(3000); 
    657             break; 
    658         case BADPIX_S1: 
    659             action_pop(); 
    660  
    661             badpix_cnt1 = init_badpixel_bin_flag; 
    662             init_badpixel_bin_flag = INIT_BADPIXEL_FILE; 
    663             shooting_set_tv96_direct(96, SET_LATER); 
    664  
    665             action_push(BADPIX_S2); 
    666             action_push(AS_SHOOT); 
    667             break; 
    668         case BADPIX_S2: 
    669             action_pop(); 
    670  
    671             console_clear(); 
    672             if (badpix_cnt1 == init_badpixel_bin_flag) { 
    673                 // TODO script asked confirmation first 
    674                 // should sanity check bad pixel count at least, 
    675                 // wrong buffer address could make badpixel bigger than available mem 
    676                 char msg[32]; 
    677                 console_add_line("badpixel.bin created."); 
    678                 sprintf(msg, "Bad pixel count: %d", badpix_cnt1); 
    679                 console_add_line(msg); 
    680                 remove(PATH_BADPIXEL_BIN); 
    681                 rename(PATH_BAD_TMP_BIN,PATH_BADPIXEL_BIN); 
    682             } else { 
    683                 console_add_line("badpixel.bin failed."); 
    684                 console_add_line("Please try again."); 
    685             } 
    686             init_badpixel_bin_flag = 0; 
    687             remove(PATH_BAD_TMP_BIN); 
    688  
    689             action_push_delay(3000); 
    690             break; 
    691         default: 
    692             action_stack_standard(p); 
    693             break; 
     752    switch(p) 
     753    { 
     754    case BADPIX_START: 
     755        action_pop(); 
     756 
     757        console_clear(); 
     758        console_add_line("Wait please... "); 
     759        console_add_line("This takes a few seconds,"); 
     760        console_add_line("don't panic!"); 
     761 
     762        init_badpixel_bin_flag = INIT_BADPIXEL_COUNT; 
     763 
     764        shooting_set_tv96_direct(96, SET_LATER); 
     765        action_push(BADPIX_S1); 
     766        action_push(AS_SHOOT); 
     767        action_push_delay(3000); 
     768        break; 
     769    case BADPIX_S1: 
     770        action_pop(); 
     771 
     772        badpix_cnt1 = init_badpixel_bin_flag; 
     773        init_badpixel_bin_flag = INIT_BADPIXEL_FILE; 
     774        shooting_set_tv96_direct(96, SET_LATER); 
     775 
     776        action_push(BADPIX_S2); 
     777        action_push(AS_SHOOT); 
     778        break; 
     779    case BADPIX_S2: 
     780        action_pop(); 
     781 
     782        console_clear(); 
     783        if (badpix_cnt1 == init_badpixel_bin_flag) 
     784        { 
     785            // TODO script asked confirmation first 
     786            // should sanity check bad pixel count at least, 
     787            // wrong buffer address could make badpixel bigger than available mem 
     788            char msg[32]; 
     789            console_add_line("badpixel.bin created."); 
     790            sprintf(msg, "Bad pixel count: %d", badpix_cnt1); 
     791            console_add_line(msg); 
     792            remove(PATH_BADPIXEL_BIN); 
     793            rename(PATH_BAD_TMP_BIN,PATH_BADPIXEL_BIN); 
     794        } 
     795        else 
     796        { 
     797            console_add_line("badpixel.bin failed."); 
     798            console_add_line("Please try again."); 
     799        } 
     800        init_badpixel_bin_flag = 0; 
     801        remove(PATH_BAD_TMP_BIN); 
     802 
     803        action_push_delay(3000); 
     804        break; 
     805    default: 
     806        action_stack_standard(p); 
     807        break; 
    694808    } 
    695809 
     
    698812 
    699813 
    700 void create_badpixel_bin() { 
    701     if (!(mode_get() & MODE_REC)) { 
     814void create_badpixel_bin() 
     815{ 
     816    if (!(mode_get() & MODE_REC)) 
     817    { 
    702818        gui_mbox_init(LANG_ERROR, LANG_MSG_RECMODE_REQUIRED, MBOX_BTN_OK|MBOX_TEXT_CENTER, NULL); 
    703819        return; 
     
    713829void write_dng(int fd, char* rawadr, char* altrawadr, unsigned long uncachedbit)  
    714830{ 
    715         create_dng_header(); 
     831    create_dng_header(); 
    716832 
    717833    if (dng_header_buf) 
    718834    { 
    719835        fill_gamma_buf(); 
    720         patch_bad_pixels_b(); 
     836        if (conf.dng_version) 
     837            patch_bad_pixels_b(); 
    721838        create_thumbnail(); 
    722839        write(fd, dng_header_buf, dng_header_buf_size); 
     
    729846 
    730847        if (rawadr == altrawadr)    // If only one RAW buffer then we have to swap the bytes back 
    731             reverse_bytes_order2(rawadr, altrawadr, camera_sensor.raw_size); 
     848            reverse_bytes_order2(rawadr, altrawadr, camera_sensor.raw_size); 
    732849 
    733850        free_dng_header(); 
     
    740857 
    741858struct libdng_sym libdng = { 
    742                         MAKE_API_VERSION(1,0),          // apiver: increase major if incompatible changes made in module,  
    743                                                                                 // increase minor if compatible changes made(including extending this struct) 
    744  
    745                         create_badpixel_bin, 
    746                         raw_init_badpixel_bin, 
    747                         capture_data_for_exif, 
    748                         load_bad_pixels_list_b, 
    749                         badpixel_list_loaded_b, 
    750  
    751                         convert_dng_to_chdk_raw, 
    752                         write_dng 
    753                 }; 
     859    MAKE_API_VERSION(1,0),      // apiver: increase major if incompatible changes made in module,  
     860    // increase minor if compatible changes made(including extending this struct) 
     861 
     862    create_badpixel_bin, 
     863    raw_init_badpixel_bin, 
     864    capture_data_for_exif, 
     865    load_bad_pixels_list_b, 
     866    badpixel_list_loaded_b, 
     867 
     868    convert_dng_to_chdk_raw, 
     869    write_dng 
     870}; 
    754871 
    755872 
    756873//------------------------------------------- 
    757874void* MODULE_EXPORT_LIST[] = { 
    758         /* 0 */ (void*)EXPORTLIST_MAGIC_NUMBER, 
    759         /* 1 */ (void*)1, 
    760  
    761                         &libdng 
    762                 }; 
     875    /* 0 */ (void*)EXPORTLIST_MAGIC_NUMBER, 
     876    /* 1 */ (void*)1, 
     877 
     878    &libdng 
     879}; 
    763880 
    764881//-------------------------------------------- 
    765882int _module_loader( unsigned int* chdk_export_list ) 
    766883{ 
    767   if ( chdk_export_list[0] != EXPORTLIST_MAGIC_NUMBER ) 
    768      return 1; 
    769  
    770   if ( !API_VERSION_MATCH_REQUIREMENT( camera_sensor.api_version, 1, 0 ) ) 
    771         return 1; 
    772   if ( !API_VERSION_MATCH_REQUIREMENT( camera_info.api_version, 1, 0 ) ) 
    773         return 1; 
    774  
    775   return 0; 
     884    if ( chdk_export_list[0] != EXPORTLIST_MAGIC_NUMBER ) 
     885        return 1; 
     886 
     887    if ( !API_VERSION_MATCH_REQUIREMENT( camera_sensor.api_version, 1, 0 ) ) 
     888        return 1; 
     889    if ( !API_VERSION_MATCH_REQUIREMENT( camera_info.api_version, 1, 0 ) ) 
     890        return 1; 
     891 
     892    return 0; 
    776893} 
    777894 
     
    783900int _module_unloader() 
    784901{ 
    785  
    786         unload_bad_pixels_list_b(); 
     902    unload_bad_pixels_list_b(); 
    787903    free_dng_header(); 
    788904    return 0; 
     
    792908/******************** Module Information structure ******************/ 
    793909 
    794 struct ModuleInfo _module_info = {      MODULEINFO_V1_MAGICNUM, 
    795                                                                         sizeof(struct ModuleInfo), 
    796  
    797                                                                         ANY_CHDK_BRANCH, 0,                     // Requirements of CHDK version 
    798                                                                         PLATFORMID,                                     // Specify platform dependency 
    799                                                                         MODULEINFO_FLAG_SYSTEM,         // flag 
    800                                                                         (int32_t)"DNG (dll)",   // Module name 
    801                                                                         1, 0,                                           // Module version 
    802                                                                         (int32_t)"Processing of DNG" 
    803                                                                  }; 
     910struct ModuleInfo _module_info = {  MODULEINFO_V1_MAGICNUM, 
     911    sizeof(struct ModuleInfo), 
     912 
     913    ANY_CHDK_BRANCH, 0,         // Requirements of CHDK version 
     914    PLATFORMID,                 // Specify platform dependency 
     915    MODULEINFO_FLAG_SYSTEM,     // flag 
     916    (int32_t)"DNG (dll)",       // Module name 
     917    1, 0,                       // Module version 
     918    (int32_t)"Processing of DNG" 
     919}; 
    804920 
    805921 
  • branches/reyalp-ptp-live/core/gui.c

    r1813 r1814  
    237237#if DNG_SUPPORT 
    238238    static void cb_change_dng();  
     239    static const char* gui_dng_version(int change, int arg); 
    239240    void gui_menuproc_badpixel_create(int arg); 
    240241#endif 
     
    494495#if CAM_ADJUSTABLE_ALT_BUTTON 
    495496    MENU_ITEM(0x22,LANG_MENU_MISC_ALT_BUTTON,               MENUITEM_ENUM,                  gui_alt_mode_button_enum,           0 ), 
     497#endif 
     498#if defined(CAM_ZOOM_ASSIST_BUTTON_CONTROL) 
     499    MENU_ITEM   (0x5c,LANG_MENU_MISC_ZOOM_ASSIST,           MENUITEM_BOOL,                  &conf.zoom_assist_button_disable,   0 ), 
    496500#endif 
    497501    MENU_ITEM(0x5d,LANG_MENU_MISC_DISABLE_LCD_OFF,    MENUITEM_ENUM,    gui_alt_power_enum, 0 ), 
     
    860864static CMenuItem raw_submenu_items[] = { 
    861865#if DNG_SUPPORT 
    862     MENU_ITEM(0x5c,LANG_MENU_RAW_SAVE,                MENUITEM_BOOL | MENUITEM_ARG_CALLBACK, &conf.save_raw, (int)cb_change_dng ), 
     866    MENU_ITEM   (0x5c,LANG_MENU_RAW_SAVE,                   MENUITEM_BOOL | MENUITEM_ARG_CALLBACK, &conf.save_raw, (int)cb_change_dng ), 
    863867#else 
    864     MENU_ITEM(0x5c,LANG_MENU_RAW_SAVE,                MENUITEM_BOOL | MENUITEM_ARG_CALLBACK, &conf.save_raw, 0 ), 
    865 #endif 
    866     MENU_ITEM(0x59,LANG_MENU_OSD_RAW_EXCEPTIONS_PARAMS,         MENUITEM_SUBMENU,   &raw_exceptions_submenu, 0 ), 
    867     MENU_ENUM2(0x5f,LANG_MENU_RAW_NOISE_REDUCTION,    &conf.raw_nr, gui_raw_nr_modes ), 
    868     MENU_ITEM(0x5c,LANG_MENU_RAW_FIRST_ONLY,          MENUITEM_BOOL,      &conf.raw_save_first_only, 0 ), 
    869     MENU_ITEM(0x5c,LANG_MENU_RAW_SAVE_IN_DIR,         MENUITEM_BOOL,      &conf.raw_in_dir, 0 ), 
    870     MENU_ENUM2a(0x5f,LANG_MENU_RAW_PREFIX,            &conf.raw_prefix, img_prefixes, NUM_IMG_PREFIXES ), 
    871     MENU_ENUM2a(0x5f,LANG_MENU_RAW_EXTENSION,         &conf.raw_ext, img_exts, NUM_IMG_EXTS ), 
    872     MENU_ENUM2a(0x5f,LANG_MENU_SUB_PREFIX,            &conf.sub_batch_prefix, img_prefixes, NUM_IMG_PREFIXES ), 
    873     MENU_ENUM2a(0x5f,LANG_MENU_SUB_EXTENSION,         &conf.sub_batch_ext, img_exts, NUM_IMG_EXTS ), 
    874 //  MENU_ITEM(0x60,LANG_MENU_SUB_IN_DARK_VALUE,       MENUITEM_INT|MENUITEM_F_UNSIGNED|MENUITEM_F_MINMAX,  &conf.sub_in_dark_value, MENU_MINMAX(0, 1023) ), 
    875 //  MENU_ITEM(0x60,LANG_MENU_SUB_OUT_DARK_VALUE,      MENUITEM_INT|MENUITEM_F_UNSIGNED|MENUITEM_F_MINMAX,  &conf.sub_out_dark_value, MENU_MINMAX(0, 1023) ), 
    876     MENU_ITEM(0x2a,LANG_MENU_RAW_DEVELOP,             MENUITEM_PROC,      gui_raw_develop, 0 ), 
    877     MENU_ITEM(0x5c,LANG_MENU_BAD_PIXEL_REMOVAL,       MENUITEM_ENUM,      gui_bad_pixel_enum, 0 ), 
     868    MENU_ITEM   (0x5c,LANG_MENU_RAW_SAVE,                   MENUITEM_BOOL | MENUITEM_ARG_CALLBACK, &conf.save_raw, 0 ), 
     869#endif 
     870    MENU_ITEM   (0x59,LANG_MENU_OSD_RAW_EXCEPTIONS_PARAMS,      MENUITEM_SUBMENU,   &raw_exceptions_submenu, 0 ), 
     871    MENU_ENUM2  (0x5f,LANG_MENU_RAW_NOISE_REDUCTION,        &conf.raw_nr, gui_raw_nr_modes ), 
     872    MENU_ITEM   (0x5c,LANG_MENU_RAW_FIRST_ONLY,             MENUITEM_BOOL,      &conf.raw_save_first_only, 0 ), 
     873    MENU_ITEM   (0x5c,LANG_MENU_RAW_SAVE_IN_DIR,            MENUITEM_BOOL,      &conf.raw_in_dir, 0 ), 
     874    MENU_ENUM2a (0x5f,LANG_MENU_RAW_PREFIX,                 &conf.raw_prefix, img_prefixes, NUM_IMG_PREFIXES ), 
     875    MENU_ENUM2a (0x5f,LANG_MENU_RAW_EXTENSION,              &conf.raw_ext, img_exts, NUM_IMG_EXTS ), 
     876    MENU_ENUM2a (0x5f,LANG_MENU_SUB_PREFIX,                 &conf.sub_batch_prefix, img_prefixes, NUM_IMG_PREFIXES ), 
     877    MENU_ENUM2a (0x5f,LANG_MENU_SUB_EXTENSION,              &conf.sub_batch_ext, img_exts, NUM_IMG_EXTS ), 
     878//  MENU_ITEM   (0x60,LANG_MENU_SUB_IN_DARK_VALUE,          MENUITEM_INT|MENUITEM_F_UNSIGNED|MENUITEM_F_MINMAX,  &conf.sub_in_dark_value, MENU_MINMAX(0, 1023) ), 
     879//  MENU_ITEM   (0x60,LANG_MENU_SUB_OUT_DARK_VALUE,         MENUITEM_INT|MENUITEM_F_UNSIGNED|MENUITEM_F_MINMAX,  &conf.sub_out_dark_value, MENU_MINMAX(0, 1023) ), 
     880    MENU_ITEM   (0x2a,LANG_MENU_RAW_DEVELOP,                MENUITEM_PROC,      gui_raw_develop, 0 ), 
     881    MENU_ITEM   (0x5c,LANG_MENU_BAD_PIXEL_REMOVAL,          MENUITEM_ENUM,      gui_bad_pixel_enum, 0 ), 
     882    MENU_ITEM   (0x5c,LANG_MENU_RAW_CACHED,                 MENUITEM_BOOL,      &conf.raw_cache,            0 ), 
    878883#if DNG_SUPPORT 
    879     MENU_ITEM(0x5c,LANG_MENU_DNG_FORMAT,              MENUITEM_BOOL | MENUITEM_ARG_CALLBACK, &conf.dng_raw , (int)cb_change_dng ), 
    880     MENU_ITEM(0x5c,LANG_MENU_RAW_DNG_EXT,             MENUITEM_BOOL,      &conf.raw_dng_ext, 0 ), 
    881     MENU_ITEM(0x2a,LANG_MENU_BADPIXEL_CREATE,         MENUITEM_PROC,      gui_menuproc_badpixel_create, 0 ), 
    882 #endif 
    883     MENU_ITEM   (0x5c,LANG_MENU_RAW_CACHED,                 MENUITEM_BOOL,      &conf.raw_cache,            0 ), 
     884    MENU_ITEM   (0x0 ,(int)"DNG",                           MENUITEM_SEPARATOR, 0,                                                      0 ), 
     885    MENU_ITEM   (0x5c,LANG_MENU_DNG_FORMAT,                 MENUITEM_BOOL | MENUITEM_ARG_CALLBACK, &conf.dng_raw , (int)cb_change_dng ), 
     886    MENU_ITEM   (0x5c,LANG_MENU_RAW_DNG_EXT,                MENUITEM_BOOL,      &conf.raw_dng_ext, 0 ), 
     887    MENU_ITEM   (0x5f,LANG_MENU_DNG_VERSION,                MENUITEM_ENUM,      gui_dng_version, 0), 
     888    MENU_ITEM   (0x2a,LANG_MENU_BADPIXEL_CREATE,            MENUITEM_PROC,      gui_menuproc_badpixel_create, 0 ), 
     889#endif 
    884890    MENU_ITEM   (0x51,LANG_MENU_BACK,                       MENUITEM_UP,        0,                          0 ), 
    885891    {0} 
     
    10371043#if DNG_SUPPORT 
    10381044void cb_change_dng(){ 
    1039      int old=conf.dng_raw; 
     1045     int old=conf.dng_version; 
    10401046     conf_change_dng(); 
    1041      if ((old==1) && (conf.dng_raw==0)) gui_mbox_init(LANG_ERROR, LANG_CANNOT_OPEN_BADPIXEL_FILE, MBOX_BTN_OK|MBOX_TEXT_CENTER, NULL); 
     1047     if ((old==1) && (conf.dng_version==0)) gui_mbox_init(LANG_ERROR, LANG_CANNOT_OPEN_BADPIXEL_FILE, MBOX_BTN_OK|MBOX_TEXT_CENTER, NULL); 
    10421048} 
    10431049     
     1050const char* gui_dng_version(int change, int arg) 
     1051{ 
     1052    static const char* modes[]={ "1.3", "1.1" }; 
     1053 
     1054    gui_enum_value_change(&conf.dng_version,change,sizeof(modes)/sizeof(modes[0])); 
     1055    cb_change_dng(); 
     1056 
     1057    return modes[conf.dng_version]; 
     1058} 
     1059 
    10441060void gui_menuproc_badpixel_create(int arg) { 
    10451061        // After this action module will not be unloaded until reboot  
     
    12251241        static const char* names[]={ "Print", "Display"}; 
    12261242        static const int keys[] = {KEY_PRINT, KEY_DISPLAY}; 
    1227     #elif defined(CAMERA_sx220hs) || defined(CAMERA_sx230hs) 
    1228         static const char* names[]={ "Disp+Set", "Display", "Playback", "Video"}; 
    1229         static const int keys[] = {KEY_PRINT, KEY_DISPLAY, KEY_PLAYBACK, KEY_VIDEO}; 
     1243    #elif defined(CAMERA_sx150is) || (CAMERA_sx220hs) || defined(CAMERA_sx230hs) || defined(CAMERA_s100) 
     1244        static const char* names[]={ "Playback", "Video", "Display" }; 
     1245        static const int keys[] = {KEY_PRINT, KEY_VIDEO, KEY_DISPLAY}; 
    12301246    #elif defined(CAMERA_ixus220_elph300hs) || defined(CAMERA_ixus230_elph310hs) 
    12311247        static const char* names[]={ "Video", "Display", "Playback", "Video"}; 
  • branches/reyalp-ptp-live/core/gui_draw.c

    r1813 r1814  
    1313//------------------------------------------------------------------- 
    1414static void draw_pixel_std(unsigned int offset, color cl) { 
    15     frame_buffer[0][offset] = frame_buffer[1][offset] = cl & 0xff; 
     15#ifdef DRAW_ON_ACTIVE_BITMAP_BUFFER_ONLY         
     16        extern int active_bitmap_buffer; 
     17        frame_buffer[active_bitmap_buffer][offset] = cl & 0xff; 
     18#else 
     19        frame_buffer[0][offset] = frame_buffer[1][offset] = cl & 0xff; 
     20#endif 
    1621} 
    1722 
  • branches/reyalp-ptp-live/core/gui_lang.h

    r1720 r1814  
    677677#define LANG_MENU_SCRIPT_START_ENABLE                   551 
    678678 
    679 #define GUI_LANG_ITEMS                          551 
     679#define LANG_MENU_MISC_ZOOM_ASSIST              552 
     680 
     681#define LANG_MENU_DNG_VERSION                   553 
     682 
     683#define GUI_LANG_ITEMS                          553 
    680684 
    681685//------------------------------------------------------------------- 
  • branches/reyalp-ptp-live/core/modules.c

    r1616 r1814  
    6969#elif CAM_SENSOR_BITS_PER_PIXEL==12 
    7070#define MODULE_NAME_RAWOP "_rawop12.flt" 
     71#elif CAM_SENSOR_BITS_PER_PIXEL==14 
     72#define MODULE_NAME_RAWOP "_rawop14.flt" 
    7173#else  
    7274 #error define set_raw_pixel for sensor bit depth 
  • branches/reyalp-ptp-live/core/raw.c

    r1711 r1814  
    212212        case 3: addr[4] = (unsigned char)value; addr[5] = (addr[5]&0xF0) | (unsigned char)(value >> 8);  break; 
    213213    } 
     214#elif CAM_SENSOR_BITS_PER_PIXEL==14 
    214215#else  
    215216    #error define set_raw_pixel for sensor bit depth 
     
    239240        case 3: return ((unsigned short)(addr[5] & 0x0F) << 8) | (addr[4]); 
    240241    } 
     242#elif CAM_SENSOR_BITS_PER_PIXEL==14 
     243    return CAM_BLACK_LEVEL; 
    241244#else  
    242245    #error define get_raw_pixel for sensor bit depth 
  • branches/reyalp-ptp-live/core/shooting.c

    r1813 r1814  
    333333int shooting_get_subject_distance_override_value() 
    334334{ 
    335   return (conf.subj_dist_override_value < shooting_get_lens_to_focal_plane_width()?0:(conf.subj_dist_override_value - shooting_get_lens_to_focal_plane_width())); 
     335    if (conf.subj_dist_override_value != INFINITY_DIST) 
     336        return (conf.subj_dist_override_value < shooting_get_lens_to_focal_plane_width()?0:(conf.subj_dist_override_value - shooting_get_lens_to_focal_plane_width())); 
     337    else 
     338        return INFINITY_DIST; 
    336339} 
    337340 
     
    10741077                s=shooting_get_near_limit_f(v,shooting_get_min_real_aperture(),get_focal_length(lens_get_zoom_point())); 
    10751078            } 
    1076             if (!conf.dof_use_exif_subj_dist)  
     1079            if (!conf.dof_use_exif_subj_dist && (s != INFINITY_DIST))  
    10771080                s+=shooting_get_lens_to_focal_plane_width(); 
    10781081            lens_set_focus_pos(s);  
  • branches/reyalp-ptp-live/include/camera.h

    r1813 r1814  
    194194    #define CAMERA_MIN_DIST         0           // Define min distance that can be set in _MoveFocusLensToDistance (allow override - e.g. G12 min dist = 1) 
    195195    #define CAMERA_MAX_DIST         65535       // Define max distance that can be set in _MoveFocusLensToDistance (allow override for superzooms - SX30/SX40) 
     196 
     197        #undef  DRAW_ON_ACTIVE_BITMAP_BUFFER_ONLY       // Draw pixels on active bitmap buffer only. Requires active_bitmap_buffer location in stubs_min.S or stubs_entry.S. 
     198         
     199    #undef  CAM_ZOOM_ASSIST_BUTTON_CONTROL      // Activate menu option to enable/disable the zoom assist button on the SX30/SX40 
     200                                                // For other cameras, requires additional support code in kbd.c (see the SX30 or SX40 version) 
    196201 
    197202//---------------------------------------------------------- 
  • branches/reyalp-ptp-live/include/conf.h

    r1720 r1814  
    6060    int raw_cache; 
    6161    int dng_raw; 
     62    int dng_version;    // User selectable DNG version (0=1.3, 1=1.1) - select 1.1 for CHDK to do bad pixel removal (requires creation of badpixel.bin) 
    6263    int raw_timer; 
    6364    int raw_dng_ext; 
     
    327328 
    328329        // gen 2 USB remote 
    329         int remote_switch_type ; 
    330         int remote_control_mode ; 
     330        int remote_switch_type; 
     331        int remote_control_mode; 
    331332 
    332333    int ext_video_time; 
    333334     
    334     int remote_enable_scripts ;  // usb remote activates scripts in <ALT> mode 
     335    int remote_enable_scripts;  // usb remote activates scripts in <ALT> mode 
    335336     
     337#if defined(CAM_ZOOM_ASSIST_BUTTON_CONTROL) 
     338    int zoom_assist_button_disable;    // used to disable the zoom assist button on SX30 & SX40 for people who keep accidentaly pressing it 
     339#endif 
     340 
    336341#ifdef CAM_HAS_GPS 
    337342    int gps_record; 
  • branches/reyalp-ptp-live/include/propset1.h

    r1711 r1814  
    4646#define PROPCASE_WB_ADJ                     100 
    4747#define PROPCASE_OPTICAL_ZOOM_POSITION      99 //untested ! 
     48#define PROPCASE_STITCH_DIRECTION           52 // 0=left>right, 1=right>left. Some cams have more 
     49#define PROPCASE_STITCH_SEQUENCE            48 // counts shots in stitch sequence, positive for left-right, negative for right-left 
    4850#endif 
  • branches/reyalp-ptp-live/include/propset2.h

    r1711 r1814  
    5151#define PROPCASE_CONTINUOUS_AF              12      //G10 0 = Continuous AF off, 1 = Continuous AF on 
    5252#define PROPCASE_DIGITAL_ZOOM_MODE          91      //G10 Digital Zoom Mode/State 0 = off/standard, 2 = 1.7x, 3 = 2.1x 
     53#define PROPCASE_STITCH_DIRECTION           233     //D10 0=left>right, 1=right>left 
     54#define PROPCASE_STITCH_SEQUENCE            238     //D10 counts shots in stitch sequence, positive=left>right, negative=right>left 
    5355#endif 
  • branches/reyalp-ptp-live/makefile.inc

    r1813 r1814  
    1 include $(topdir)chdk_ver.inc 
    21 
    32MEMISOSIZE="(&_end-&_start)" 
     
    1211include $(topdir)version.inc 
    1312-include $(topdir)revision.inc 
     13 
     14ifndef OPT_DE_VERSION 
     15    VER=CHDK 
     16else 
     17    VER=CHDK_DE 
     18    ifndef OPT_DEFAULT_LANG 
     19        OPT_DEFAULT_LANG=german 
     20    endif 
     21endif 
    1422 
    1523ifdef PLATFORM 
     
    140148LDFLAGS+=-L$(topdir)platform/$(PLATFORM) -L$(topdir)platform/$(PLATFORM)/sub/$(PLATFORMSUB) 
    141149 
    142 ifeq ($(VER),CHDK) 
     150ifndef OPT_DE_VERSION 
    143151CFLAGS+=-DVER_CHDK 
    144152else 
  • branches/reyalp-ptp-live/platform/a1000/main.c

    r1641 r1814  
    2828} 
    2929 
    30 static const int fl_tbl[] = {5800, 6420, 7060, 7700, 8340, 9950, 11550, 13160, 14750, 17150, 19570, 22760, 26750, 30750, 34800}; 
    31 #define NUM_FL (sizeof(fl_tbl)/sizeof(fl_tbl[0])) 
    32 #define CF_EFL 60345 
     30// Focus length table in firmware @0xfffe297c 
     31#define NUM_FL      8   // 0 - 7, entries in firmware 
     32#define NUM_DATA    3   // 3 words each entry, first is FL 
     33extern int focus_len_table[NUM_FL*NUM_DATA]; 
     34 
     35// Conversion factor lens FL --> 35mm equiv 
     36// lens      35mm     CF 
     37// ----      ----     -- 
     38// 6.2       35       ( 35/ 6.2) * 62 = 350  (min FL) 
     39// 24.8      140      (140/24.8) * 62 = 350  (max FL) 
     40#define CF_EFL      350 
     41#define CF_EFL_DIV  62 
    3342 
    3443const int zoom_points = NUM_FL; 
    3544 
    3645int get_effective_focal_length(int zp) { 
    37     return (CF_EFL*get_focal_length(zp))/10000; 
     46    return (CF_EFL*get_focal_length(zp))/CF_EFL_DIV; 
    3847} 
    3948 
    4049int get_focal_length(int zp) { 
    41     if (zp<0) return fl_tbl[0]; 
    42     else if (zp>NUM_FL-1) return fl_tbl[NUM_FL-1]; 
    43     else return fl_tbl[zp]; 
     50    if (zp < 0) zp = 0; 
     51    else if (zp >= NUM_FL) zp = NUM_FL-1; 
     52    return focus_len_table[zp*NUM_DATA]; 
    4453} 
    4554 
    4655int get_zoom_x(int zp) { 
    47     if (zp<1) return 10; 
    48     else if (zp>NUM_FL-1) return fl_tbl[NUM_FL-1]*10/fl_tbl[0]; 
    49     else return fl_tbl[zp]*10/fl_tbl[0]; 
     56    return get_focal_length(zp)*10/focus_len_table[0]; 
    5057} 
    5158 
  • branches/reyalp-ptp-live/platform/a1100/main.c

    r1233 r1814  
    2929} 
    3030 
    31 static const int fl_tbl[] = {6200, 7780, 9410, 11370, 13790, 16770, 20180, 24800}; 
    32 #define NUM_FL (sizeof(fl_tbl)/sizeof(fl_tbl[0])) 
    33 #define CF_EFL 56451   //---corect 
     31// Focus length table in firmware @0xfffe2a8c 
     32#define NUM_FL      8   // 0 - 7, entries in firmware 
     33#define NUM_DATA    3   // 3 words each entry, first is FL 
     34extern int focus_len_table[NUM_FL*NUM_DATA]; 
     35 
     36// Conversion factor lens FL --> 35mm equiv 
     37// lens      35mm     CF 
     38// ----      ----     -- 
     39// 6.2       35       ( 35/ 6.2) * 62 = 350  (min FL) 
     40// 24.8      140      (140/24.8) * 62 = 350  (max FL) 
     41#define CF_EFL      350 
     42#define CF_EFL_DIV  62 
    3443 
    3544const int zoom_points = NUM_FL; 
    3645 
    3746int get_effective_focal_length(int zp) { 
    38     return (CF_EFL*get_focal_length(zp))/10000; 
     47    return (CF_EFL*get_focal_length(zp))/CF_EFL_DIV; 
    3948} 
    4049 
    4150int get_focal_length(int zp) { 
    42     if (zp<0) return fl_tbl[0]; 
    43     else if (zp>NUM_FL-1) return fl_tbl[NUM_FL-1]; 
    44     else return fl_tbl[zp]; 
     51    if (zp < 0) zp = 0; 
     52    else if (zp >= NUM_FL) zp = NUM_FL-1; 
     53    return focus_len_table[zp*NUM_DATA]; 
    4554} 
    4655 
    4756int get_zoom_x(int zp) { 
    48     if (zp<1) return 10; 
    49     else if (zp>NUM_FL-1) return fl_tbl[NUM_FL-1]*10/fl_tbl[0]; 
    50     else return fl_tbl[zp]*10/fl_tbl[0]; 
     57    return get_focal_length(zp)*10/focus_len_table[0]; 
    5158} 
    5259 
  • branches/reyalp-ptp-live/platform/a2000/main.c

    r847 r1814  
    2929} 
    3030 
    31 static const int fl_tbl[] = {6400, 6800, 7600, 8800, 10500, 12300, 14100, 16100, 18500, 21200, 24000, 27100, 30700, 35100, 38400}; 
    32 #define NUM_FL (sizeof(fl_tbl)/sizeof(fl_tbl[0])) 
     31// Focus length table in firmware @0xfffe297c 
     32#define NUM_FL      15  // 0 - 14, entries in firmware 
     33#define NUM_DATA    3   // 3 words each entry, first is FL 
     34extern int focus_len_table[NUM_FL*NUM_DATA]; 
    3335 
    34 // focal length range is 6.4 - 38.4 mm, 36 - 216 in 35-mm equivalent. 
    35 // So, CF_EFL = 36/6.4 * 1000 = 56250 or 216/38.4 * 1000 = 56250. 
    36 #define CF_EFL 5625 
     36// Conversion factor lens FL --> 35mm equiv 
     37// lens      35mm     CF 
     38// ----      ----     -- 
     39// 6.4       36       ( 36/ 6.4) * 64 = 360  (min FL) 
     40// 38.4      216      (216/38.4) * 64 = 360  (max FL) 
     41#define CF_EFL      360 
     42#define CF_EFL_DIV  64 
    3743 
    3844const int zoom_points = NUM_FL; 
    3945 
    4046int get_effective_focal_length(int zp) { 
    41         return (CF_EFL*get_focal_length(zp))/1000; 
     47    return (CF_EFL*get_focal_length(zp))/CF_EFL_DIV; 
    4248} 
    4349 
    4450int get_focal_length(int zp) { 
    45     if (zp<0) return fl_tbl[0]; 
    46     else if (zp>NUM_FL-1) return fl_tbl[NUM_FL-1]; 
    47     else return fl_tbl[zp]; 
     51    if (zp < 0) zp = 0; 
     52    else if (zp >= NUM_FL) zp = NUM_FL-1; 
     53    return focus_len_table[zp*NUM_DATA]; 
    4854} 
    4955 
    5056int get_zoom_x(int zp) { 
    51     if (zp<1) return 10; 
    52     else if (zp>NUM_FL-1) return fl_tbl[NUM_FL-1]*10/fl_tbl[0]; 
    53     else return fl_tbl[zp]*10/fl_tbl[0]; 
     57    return get_focal_length(zp)*10/focus_len_table[0]; 
    5458} 
    55  
    5659 
    5760long get_vbatt_min() 
  • branches/reyalp-ptp-live/platform/a3000/main.c

    r1372 r1814  
    2626} 
    2727 
    28 //zoom position is get_parameter_data(87) 
    29 static const struct { 
    30         int zp, fl; 
    31 } fl_tbl[] = { 
    32   {   0,   6200}, 
    33   {   1,   7780}, 
    34   {   2,   9410}, 
    35   {   3,   11370}, 
    36   {   4,   13790}, 
    37   {   5,   16770}, 
    38   {   6,   20180}, 
    39   {   7,   24800}, 
    40 }; 
     28// Focus length table in firmware @0xfffe29b0 
     29#define NUM_FL      8   // 0 - 7, entries in firmware 
     30#define NUM_DATA    3   // 3 words each entry, first is FL 
     31extern int focus_len_table[NUM_FL*NUM_DATA]; 
    4132 
    42 #define NUM_FL (sizeof(fl_tbl)/sizeof(fl_tbl[0])) 
    43 // A3000IS focal lenght range 6.2 - 24.8 mm (35 mm equivalent: 34.8 - 139.4 mm)(1/2.3" (7.7mm, crop 5.62) Type CCD, Scale Factor To 35 mm Equivalent: 4.6) 
    44 // 34.8/6.2*10000=56129 
    45 // 139.4/24.8*10000=56210 
    46  
    47 #define CF_EFL 56200 
     33// Conversion factor lens FL --> 35mm equiv 
     34// lens      35mm     CF 
     35// ----      ----     -- 
     36// 6.2       35       ( 35/ 6.2) * 62 = 350  (min FL) 
     37// 24.8      140      (140/24.8) * 62 = 350  (max FL) 
     38#define CF_EFL      350 
     39#define CF_EFL_DIV  62 
    4840 
    4941const int zoom_points = NUM_FL; 
    5042 
    5143int get_effective_focal_length(int zp) { 
    52     return (CF_EFL*get_focal_length(zp))/10000; 
     44    return (CF_EFL*get_focal_length(zp))/CF_EFL_DIV; 
    5345} 
    5446 
    5547int get_focal_length(int zp) { 
    56         int i; 
    57  
    58         if (zp<fl_tbl[0].zp) 
    59                 return fl_tbl[0].fl; 
    60         else if (zp>fl_tbl[NUM_FL-1].zp) 
    61                 return fl_tbl[NUM_FL-1].fl; 
    62         else  
    63                 for (i=1; i<NUM_FL; ++i) { 
    64                         if (zp==fl_tbl[i-1].zp)  
    65                                 return fl_tbl[i-1].fl; 
    66                         else if (zp==fl_tbl[i].zp)  
    67                                 return fl_tbl[i].fl; 
    68                         else if (zp<fl_tbl[i].zp) 
    69                                 return fl_tbl[i-1].fl+(zp-fl_tbl[i-1].zp)*(fl_tbl[i].fl-fl_tbl[i-1].fl)/(fl_tbl[i].zp-fl_tbl[i-1].zp); 
    70                 } 
    71         return fl_tbl[NUM_FL-1].fl; 
     48    if (zp < 0) zp = 0; 
     49    else if (zp >= NUM_FL) zp = NUM_FL-1; 
     50    return focus_len_table[zp*NUM_DATA]; 
    7251} 
    7352 
    7453int get_zoom_x(int zp) { 
    75         return get_focal_length(zp)*10/fl_tbl[0].fl; 
     54    return get_focal_length(zp)*10/focus_len_table[0]; 
    7655} 
    77  
    7856 
    7957long get_vbatt_min() 
  • branches/reyalp-ptp-live/platform/a3300/main.c

    r1620 r1814  
    2828} 
    2929 
     30// Focus length table in firmware @0xfffe2f88 
     31#define NUM_FL      12  // 0 - 11, entries in firmware 
     32#define NUM_DATA    3   // 3 words each entry, first is FL 
     33extern int focus_len_table[NUM_FL*NUM_DATA]; 
    3034 
    31 #define NUM_FL 12 
    32 extern int focus_len_table[NUM_FL*3]; 
    33 //a3300is 
    34 // Focal length range is 5.0 - 25.0 mm, 28 - 140 in 35-mm equivalent. 
    35 // So, CF_EFL = 28/5.0*10000=56000 or 140/25*10000=56000 
    36 // divide by 10 to avoid overflow in get_effective_focal_length() 
    37 #define CF_EFL  5600 
     35// Conversion factor lens FL --> 35mm equiv 
     36// lens      35mm     CF 
     37// ----      ----     -- 
     38// 5.0       28       ( 28/ 5.0) * 50 = 280  (min FL) 
     39// 25.0      140      (140/25.0) * 50 = 280  (max FL) 
     40#define CF_EFL      280 
     41#define CF_EFL_DIV  50 
     42 
    3843const int zoom_points = NUM_FL; 
    3944 
    40  
    4145int get_effective_focal_length(int zp) { 
    42         return (CF_EFL*get_focal_length(zp))/10000; 
     46    return (CF_EFL*get_focal_length(zp))/CF_EFL_DIV; 
    4347} 
    4448 
    45  
    4649int get_focal_length(int zp) { 
    47          
    48         if (zp < 0) zp = 0; 
    49         else if (zp >= NUM_FL) zp = NUM_FL-1; 
    50         return focus_len_table[zp*3]; 
    51  
     50    if (zp < 0) zp = 0; 
     51    else if (zp >= NUM_FL) zp = NUM_FL-1; 
     52    return focus_len_table[zp*NUM_DATA]; 
    5253} 
    5354 
    54  
    5555int get_zoom_x(int zp) { 
    56         return get_focal_length(zp)*10/focus_len_table[0]; 
    57  
     56    return get_focal_length(zp)*10/focus_len_table[0]; 
    5857} 
    59  
    60  
    6158 
    6259long get_vbatt_min() 
  • branches/reyalp-ptp-live/platform/a3300/sub/100a/stubs_entry.S

    r1658 r1814  
    4646DEF(focus_busy                              ,0x000064d8) // Found @0xff960130 
    4747DEF(recreview_hold                          ,0x00003534) // Found @0xff89af5c 
     48DEF(palette_control                         ,0x0000916c) // Found @0xffa06c70 
     49DEF(active_palette_buffer                   ,0x00009174) // Found @0xffa06c74 
     50DEF(palette_buffer                          ,0x000b477c) // Found @0xffa07028 
    4851 
    4952// Values below go in 'lib.c': 
  • branches/reyalp-ptp-live/platform/a3300/sub/100c/stubs_entry.S

    r1658 r1814  
    4646DEF(focus_busy                              ,0x000064d8) // Found @0xff960130 
    4747DEF(recreview_hold                          ,0x00003534) // Found @0xff89af5c 
     48DEF(palette_control                         ,0x0000916c) // Found @0xffa06c70 
     49DEF(active_palette_buffer                   ,0x00009174) // Found @0xffa06c74 
     50DEF(palette_buffer                          ,0x000b477c) // Found @0xffa07028 
    4851 
    4952// Values below go in 'lib.c': 
  • branches/reyalp-ptp-live/platform/a3300/sub/100d/stubs_entry.S

    r1658 r1814  
    4646DEF(focus_busy                              ,0x000064d8) // Found @0xff960130 
    4747DEF(recreview_hold                          ,0x00003534) // Found @0xff89af5c 
     48DEF(palette_control                         ,0x0000916c) // Found @0xffa06c70 
     49DEF(active_palette_buffer                   ,0x00009174) // Found @0xffa06c74 
     50DEF(palette_buffer                          ,0x000b477c) // Found @0xffa07028 
    4851 
    4952// Values below go in 'lib.c': 
  • branches/reyalp-ptp-live/platform/a480/main.c

    r884 r1814  
    2828} 
    2929 
    30 static const int fl_tbl[] = {6600, 8060, 9840, 12050, 14800, 17550, 21600}; 
    31 #define NUM_FL (sizeof(fl_tbl)/sizeof(fl_tbl[0])) 
    32 #define CF_EFL 56481L 
     30// Focus length table in firmware @0xfffe297c 
     31#define NUM_FL      7   // 0 - 6, entries in firmware 
     32#define NUM_DATA    3   // 3 words each entry, first is FL 
     33extern int focus_len_table[NUM_FL*NUM_DATA]; 
     34 
     35// Conversion factor lens FL --> 35mm equiv 
     36// lens      35mm     CF 
     37// ----      ----     -- 
     38// 6.6       37       ( 37/ 6.6) * 66 = 370  (min FL) 
     39// 21.6      122      (122/21.6) * 66 = 372,8  (max FL) 
     40#define CF_EFL      370 
     41#define CF_EFL_DIV  66 
    3342 
    3443const int zoom_points = NUM_FL; 
    3544 
    3645int get_effective_focal_length(int zp) { 
    37     return (CF_EFL*get_focal_length(zp))/10000; 
     46    return (CF_EFL*get_focal_length(zp))/CF_EFL_DIV; 
    3847} 
    3948 
    4049int get_focal_length(int zp) { 
    41     if (zp<0) return fl_tbl[0]; 
    42     else if (zp>NUM_FL-1) return fl_tbl[NUM_FL-1]; 
    43     else return fl_tbl[zp]; 
     50    if (zp < 0) zp = 0; 
     51    else if (zp >= NUM_FL) zp = NUM_FL-1; 
     52    return focus_len_table[zp*NUM_DATA]; 
    4453} 
    4554 
    4655int get_zoom_x(int zp) { 
    47     if (zp<1) return 10; 
    48     else if (zp>NUM_FL-1) return fl_tbl[NUM_FL-1]*10/fl_tbl[0]; 
    49     else return fl_tbl[zp]*10/fl_tbl[0]; 
     56    return get_focal_length(zp)*10/focus_len_table[0]; 
    5057} 
    51  
    5258 
    5359long get_vbatt_min() 
  • branches/reyalp-ptp-live/platform/a490/main.c

    r1205 r1814  
    2828} 
    2929 
    30 // TODO: Check focal length table 
    31 static const int fl_tbl[] = {6600, 8060, 9840, 12050, 14800, 17550, 21600}; 
    32 #define NUM_FL (sizeof(fl_tbl)/sizeof(fl_tbl[0])) 
    33 #define CF_EFL 56481L 
     30// Focus length table in firmware @0xfffe2990 
     31#define NUM_FL      7   // 0 - 6, entries in firmware 
     32#define NUM_DATA    3   // 3 words each entry, first is FL 
     33extern int focus_len_table[NUM_FL*NUM_DATA]; 
     34 
     35// Conversion factor lens FL --> 35mm equiv 
     36// lens      35mm     CF 
     37// ----      ----     -- 
     38// 6.6       37       ( 37/ 6.6) * 66 = 370  (min FL) 
     39// 21.6      122      (122/21.6) * 66 = 372.8  (max FL) 
     40#define CF_EFL      370 
     41#define CF_EFL_DIV  66 
    3442 
    3543const int zoom_points = NUM_FL; 
    3644 
    3745int get_effective_focal_length(int zp) { 
    38     return (CF_EFL*get_focal_length(zp))/10000; 
     46    return (CF_EFL*get_focal_length(zp))/CF_EFL_DIV; 
    3947} 
    4048 
    4149int get_focal_length(int zp) { 
    42     if (zp<0) return fl_tbl[0]; 
    43     else if (zp>NUM_FL-1) return fl_tbl[NUM_FL-1]; 
    44     else return fl_tbl[zp]; 
     50    if (zp < 0) zp = 0; 
     51    else if (zp >= NUM_FL) zp = NUM_FL-1; 
     52    return focus_len_table[zp*NUM_DATA]; 
    4553} 
    4654 
    4755int get_zoom_x(int zp) { 
    48     if (zp<1) return 10; 
    49     else if (zp>NUM_FL-1) return fl_tbl[NUM_FL-1]*10/fl_tbl[0]; 
    50     else return fl_tbl[zp]*10/fl_tbl[0]; 
     56    return get_focal_length(zp)*10/focus_len_table[0]; 
    5157} 
    5258 
  • branches/reyalp-ptp-live/platform/a495/main.c

    r1376 r1814  
    2828} 
    2929 
    30 // TODO: Check focal length table 
    31 static const int fl_tbl[] = {6600, 8060, 9840, 12050, 14800, 17550, 21600}; 
    32 #define NUM_FL (sizeof(fl_tbl)/sizeof(fl_tbl[0])) 
    33 #define CF_EFL 56481L 
     30// Focus length table in firmware @0xfffe2990 
     31#define NUM_FL      7   // 0 - 6, entries in firmware 
     32#define NUM_DATA    3   // 3 words each entry, first is FL 
     33extern int focus_len_table[NUM_FL*NUM_DATA]; 
     34 
     35// Conversion factor lens FL --> 35mm equiv 
     36// lens      35mm     CF 
     37// ----      ----     -- 
     38// 6.6       37       ( 37/ 6.6) * 66 = 370  (min FL) 
     39// 21.6      122      (122/21.6) * 66 = 372,8  (max FL) 
     40#define CF_EFL      370 
     41#define CF_EFL_DIV  66 
    3442 
    3543const int zoom_points = NUM_FL; 
    3644 
    3745int get_effective_focal_length(int zp) { 
    38     return (CF_EFL*get_focal_length(zp))/10000; 
     46    return (CF_EFL*get_focal_length(zp))/CF_EFL_DIV; 
    3947} 
    4048 
    4149int get_focal_length(int zp) { 
    42     if (zp<0) return fl_tbl[0]; 
    43     else if (zp>NUM_FL-1) return fl_tbl[NUM_FL-1]; 
    44     else return fl_tbl[zp]; 
     50    if (zp < 0) zp = 0; 
     51    else if (zp >= NUM_FL) zp = NUM_FL-1; 
     52    return focus_len_table[zp*NUM_DATA]; 
    4553} 
    4654 
    4755int get_zoom_x(int zp) { 
    48     if (zp<1) return 10; 
    49     else if (zp>NUM_FL-1) return fl_tbl[NUM_FL-1]*10/fl_tbl[0]; 
    50     else return fl_tbl[zp]*10/fl_tbl[0]; 
     56    return get_focal_length(zp)*10/focus_len_table[0]; 
    5157} 
    5258 
  • branches/reyalp-ptp-live/platform/a580/main.c

    r1308 r1814  
    2929} 
    3030 
     31// Focus length table in firmware @0xfffe297c 
     32#define NUM_FL      8   // 0 - 7, entries in firmware 
     33#define NUM_DATA    3   // 3 words each entry, first is FL 
     34extern int focus_len_table[NUM_FL*NUM_DATA]; 
    3135 
    32 static const int fl_tbl[] = {5800, 6700, 8000, 10000, 12600, 15800, 19300, 23200}; 
    33 #define NUM_FL (sizeof(fl_tbl)/sizeof(fl_tbl[0])) 
    34 #define CF_EFL 60345 //OK 
     36// Conversion factor lens FL --> 35mm equiv 
     37// lens      35mm     CF 
     38// ----      ----     -- 
     39// 5.8       35       ( 35/ 5.8) * 58 = 350  (min FL) 
     40// 23.2      140      (140/23.2) * 58 = 350  (max FL) 
     41#define CF_EFL      350 
     42#define CF_EFL_DIV  58 
    3543 
    3644const int zoom_points = NUM_FL; 
    3745 
    3846int get_effective_focal_length(int zp) { 
    39     return (CF_EFL*get_focal_length(zp))/10000; 
     47    return (CF_EFL*get_focal_length(zp))/CF_EFL_DIV; 
    4048} 
    4149 
    4250int get_focal_length(int zp) { 
    43     if (zp<0) return fl_tbl[0]; 
    44     else if (zp>NUM_FL-1) return fl_tbl[NUM_FL-1]; 
    45     else return fl_tbl[zp]; 
     51    if (zp < 0) zp = 0; 
     52    else if (zp >= NUM_FL) zp = NUM_FL-1; 
     53    return focus_len_table[zp*NUM_DATA]; 
    4654} 
    4755 
    4856int get_zoom_x(int zp) { 
    49     if (zp<1) return 10; 
    50     else if (zp>NUM_FL-1) return fl_tbl[NUM_FL-1]*10/fl_tbl[0]; 
    51     else return fl_tbl[zp]*10/fl_tbl[0]; 
     57    return get_focal_length(zp)*10/focus_len_table[0]; 
    5258} 
    5359 
  • branches/reyalp-ptp-live/platform/a590/main.c

    r847 r1814  
    3030} 
    3131 
    32 static const int fl_tbl[] = {5800, 6600, 7900, 9900, 12700, 16000, 19600, 23200}; 
    33 #define NUM_FL (sizeof(fl_tbl)/sizeof(fl_tbl[0])) 
    34 #define CF_EFL 60345 
     32// Focus length table in firmware @0xfffe29ac 
     33#define NUM_FL      8   // 0 - 7, entries in firmware 
     34#define NUM_DATA    3   // 3 words each entry, first is FL 
     35extern int focus_len_table[NUM_FL*NUM_DATA]; 
     36 
     37// Conversion factor lens FL --> 35mm equiv 
     38// lens      35mm     CF 
     39// ----      ----     -- 
     40// 5.8       35       ( 35/ 5.8) * 58 = 350  (min FL) 
     41// 23.2      140      (140/23.2) * 58 = 350  (max FL) 
     42#define CF_EFL      350 
     43#define CF_EFL_DIV  58 
    3544 
    3645const int zoom_points = NUM_FL; 
    3746 
    3847int get_effective_focal_length(int zp) { 
    39     return (CF_EFL*get_focal_length(zp))/10000; 
     48    return (CF_EFL*get_focal_length(zp))/CF_EFL_DIV; 
    4049} 
    4150 
    4251int get_focal_length(int zp) { 
    43     if (zp<0) return fl_tbl[0]; 
    44     else if (zp>NUM_FL-1) return fl_tbl[NUM_FL-1]; 
    45     else return fl_tbl[zp]; 
     52    if (zp < 0) zp = 0; 
     53    else if (zp >= NUM_FL) zp = NUM_FL-1; 
     54    return focus_len_table[zp*NUM_DATA]; 
    4655} 
    4756 
    4857int get_zoom_x(int zp) { 
    49     if (zp<1) return 10; 
    50     else if (zp>NUM_FL-1) return fl_tbl[NUM_FL-1]*10/fl_tbl[0]; 
    51     else return fl_tbl[zp]*10/fl_tbl[0]; 
     58    return get_focal_length(zp)*10/focus_len_table[0]; 
    5259} 
    5360 
  • branches/reyalp-ptp-live/platform/a720/main.c

    r847 r1814  
    2929} 
    3030 
     31// Focus length table in firmware @0xfffe299c 
     32#define NUM_FL      15  // 0 - 14, entries in firmware 
     33#define NUM_DATA    3   // 3 words each entry, first is FL 
     34extern int focus_len_table[NUM_FL*NUM_DATA]; 
    3135 
    32 static const int fl_tbl[] = {5800, 6420, 7060, 7700, 8340, 9950, 11550, 13160, 14750, 17150, 19570, 22760, 26750, 30750, 34800}; 
    33 #define NUM_FL (sizeof(fl_tbl)/sizeof(fl_tbl[0])) 
    34 #define CF_EFL 60345 
     36// Conversion factor lens FL --> 35mm equiv 
     37// lens      35mm     CF 
     38// ----      ----     -- 
     39// 5.8       35       ( 35/ 5.8) * 58 = 350  (min FL) 
     40// 34.8      210      (210/34.8) * 58 = 350  (max FL) 
     41#define CF_EFL      350 
     42#define CF_EFL_DIV  58 
    3543 
    3644const int zoom_points = NUM_FL; 
    3745 
    3846int get_effective_focal_length(int zp) { 
    39     return (CF_EFL*get_focal_length(zp))/10000; 
     47    return (CF_EFL*get_focal_length(zp))/CF_EFL_DIV; 
    4048} 
    4149 
    4250int get_focal_length(int zp) { 
    43     if (zp<0) return fl_tbl[0]; 
    44     else if (zp>NUM_FL-1) return fl_tbl[NUM_FL-1]; 
    45     else return fl_tbl[zp]; 
     51    if (zp < 0) zp = 0; 
     52    else if (zp >= NUM_FL) zp = NUM_FL-1; 
     53    return focus_len_table[zp*NUM_DATA]; 
    4654} 
    4755 
    4856int get_zoom_x(int zp) { 
    49     if (zp<1) return 10; 
    50     else if (zp>NUM_FL-1) return fl_tbl[NUM_FL-1]*10/fl_tbl[0]; 
    51     else return fl_tbl[zp]*10/fl_tbl[0]; 
     57    return get_focal_length(zp)*10/focus_len_table[0]; 
    5258} 
    5359 
  • branches/reyalp-ptp-live/platform/a800/main.c

    r1723 r1814  
    2828} 
    2929 
    30 // TODO: Check focal length table 
    31 static const int fl_tbl[] = {6600, 8060, 9840, 12050, 14800, 21600}; 
    32 #define NUM_FL (sizeof(fl_tbl)/sizeof(fl_tbl[0])) 
    33 #define CF_EFL 56481L 
     30// Focus length table in firmware @0xfffe2ee8 
     31#define NUM_FL      7   // 0 - 6, entries in firmware 
     32#define NUM_DATA    3   // 3 words each entry, first is FL 
     33extern int focus_len_table[NUM_FL*NUM_DATA]; 
     34 
     35// Conversion factor lens FL --> 35mm equiv 
     36// lens      35mm     CF 
     37// ----      ----     -- 
     38// 6.6       37       ( 37/ 6.6) * 66 = 370  (min FL) 
     39// 21.6      122      (122/21.6) * 66 = 372.7  (max FL) 
     40#define CF_EFL      370 
     41#define CF_EFL_DIV  66 
    3442 
    3543const int zoom_points = NUM_FL; 
    3644 
    3745int get_effective_focal_length(int zp) { 
    38     return (CF_EFL*get_focal_length(zp))/10000; 
     46    return (CF_EFL*get_focal_length(zp))/CF_EFL_DIV; 
    3947} 
    4048 
    4149int get_focal_length(int zp) { 
    42     if (zp<0) return fl_tbl[0]; 
    43     else if (zp>NUM_FL-1) return fl_tbl[NUM_FL-1]; 
    44     else return fl_tbl[zp]; 
     50    if (zp < 0) zp = 0; 
     51    else if (zp >= NUM_FL) zp = NUM_FL-1; 
     52    return focus_len_table[zp*NUM_DATA]; 
    4553} 
    4654 
    4755int get_zoom_x(int zp) { 
    48     if (zp<1) return 10; 
    49     else if (zp>NUM_FL-1) return fl_tbl[NUM_FL-1]*10/fl_tbl[0]; 
    50     else return fl_tbl[zp]*10/fl_tbl[0]; 
     56    return get_focal_length(zp)*10/focus_len_table[0]; 
    5157} 
    5258 
  • branches/reyalp-ptp-live/platform/a800/shooting.c

    r1723 r1814  
    110110 
    111111#if defined(CAM_DATE_FOLDER_NAMING) 
    112 void get_target_dir_name(char *out) { 
     112// A800 uses date to name directory 
     113void get_target_dir_name(char *out)  
     114{ 
    113115    extern void _GetImageFolder(char*,int,int,int); 
    114     out[0] = 'A'; 
    115     _GetImageFolder(out+1,get_file_next_counter(),CAM_DATE_FOLDER_NAMING,time(NULL)); 
    116     out[15] = '\0'; 
     116        _GetImageFolder(out,get_file_next_counter(),0x400,time(NULL)); 
    117117} 
    118118#else 
  • branches/reyalp-ptp-live/platform/a800/sub/100c/stubs_entry.S

    r1813 r1814  
    4545DEF(focus_busy                              ,0x0000551c) // Found @0xffd125c4 
    4646DEF(recreview_hold                          ,0x000030d4) // Found @0xffc78de0 
     47DEF(palette_control                         ,0x00007810) // Found @0xffd88c44 
     48DEF(active_palette_buffer                   ,0x00007818) // Found @0xffd88c48 
     49DEF(palette_buffer                          ,0x00088f3c) // Found @0xffd88ff0 
    4750 
    4851// Values below go in 'lib.c': 
  • branches/reyalp-ptp-live/platform/d10/main.c

    r897 r1814  
    4343CF_EFL ~54800-56000 
    4444*/ 
    45 static const int fl_tbl[] = {6200, 7200, 8300, 9700, 11600, 14300, 18600}; 
    46 #define NUM_FL (sizeof(fl_tbl)/sizeof(fl_tbl[0])) 
    47 #define CF_EFL 55400 
     45 
     46// Focus length table in firmware @0xfffe2a8c 
     47#define NUM_FL      7   // 0 - 6, entries in firmware 
     48#define NUM_DATA    3   // 3 words each entry, first is FL 
     49extern int focus_len_table[NUM_FL*NUM_DATA]; 
     50 
     51// Conversion factor lens FL --> 35mm equiv 
     52// lens      35mm     CF 
     53// ----      ----     -- 
     54// 6.2       35       ( 35/ 6.2) * 62 = 350  (min FL) 
     55// 18.6      105      (105/18.6) * 62 = 350  (max FL) 
     56#define CF_EFL      350 
     57#define CF_EFL_DIV  62 
    4858 
    4959const int zoom_points = NUM_FL; 
    5060 
    5161int get_effective_focal_length(int zp) { 
    52     return (CF_EFL*get_focal_length(zp))/10000; 
     62    return (CF_EFL*get_focal_length(zp))/CF_EFL_DIV; 
    5363} 
    5464 
    5565int get_focal_length(int zp) { 
    56     if (zp<0) return fl_tbl[0]; 
    57     else if (zp>NUM_FL-1) return fl_tbl[NUM_FL-1]; 
    58     else return fl_tbl[zp]; 
     66    if (zp < 0) zp = 0; 
     67    else if (zp >= NUM_FL) zp = NUM_FL-1; 
     68    return focus_len_table[zp*NUM_DATA]; 
    5969} 
    6070 
    6171int get_zoom_x(int zp) { 
    62     if (zp<1) return 10; 
    63     else if (zp>NUM_FL-1) return fl_tbl[NUM_FL-1]*10/fl_tbl[0]; 
    64     else return fl_tbl[zp]*10/fl_tbl[0]; 
     72    return get_focal_length(zp)*10/focus_len_table[0]; 
    6573} 
    66  
    6774 
    6875// uses NB-6L, similar specs to NB-5L, copied from sd990 below  
  • branches/reyalp-ptp-live/platform/g10/main.c

    r1329 r1814  
    2828} 
    2929 
    30 // G10 focus length table in firmware @ FFFE2A8C for 1.02a, 1.03b & 1.04a 
    31 // Note: same lens & table as G12 
    32  
    33 #define NUM_FL 14               // 0 - 13, entries in firmware (3 words each entry, first is FL) 
    34 extern int focus_len_table[NUM_FL*3]; 
     30// Focus length table in firmware @0xfffe2a8c 
     31#define NUM_FL      14  // 0 - 13, entries in firmware 
     32#define NUM_DATA    3   // 3 words each entry, first is FL 
     33extern int focus_len_table[NUM_FL*NUM_DATA]; 
    3534 
    3635// Conversion factor lens FL --> 35mm equiv 
    3736// lens      35mm     CF 
    3837// ----      ----     -- 
    39 // 6.1       28       (28/6.1) * 61 = 280  (min FL) 
     38// 6.1       28       ( 28/ 6.1) * 61 = 280  (min FL) 
    4039// 30.5      140      (140/30.5) * 61 = 280  (max FL) 
    41  
    42 #define CF_EFL 280 
    43 #define CF_EFL_DIV 61 
     40#define CF_EFL      280 
     41#define CF_EFL_DIV  61 
    4442 
    4543const int zoom_points = NUM_FL; 
    4644 
    4745int get_effective_focal_length(int zp) { 
    48         return (CF_EFL*get_focal_length(zp))/CF_EFL_DIV; 
     46    return (CF_EFL*get_focal_length(zp))/CF_EFL_DIV; 
    4947} 
    5048 
    5149int get_focal_length(int zp) { 
    52         if (zp < 0) zp = 0; 
    53         else if (zp >= NUM_FL) zp = NUM_FL-1; 
    54         return focus_len_table[zp*3]; 
     50    if (zp < 0) zp = 0; 
     51    else if (zp >= NUM_FL) zp = NUM_FL-1; 
     52    return focus_len_table[zp*NUM_DATA]; 
    5553} 
    5654 
    5755int get_zoom_x(int zp) { 
    58         return get_focal_length(zp)*10/focus_len_table[0]; 
     56    return get_focal_length(zp)*10/focus_len_table[0]; 
    5957} 
    6058 
  • branches/reyalp-ptp-live/platform/g11/main.c

    r1641 r1814  
    2626} 
    2727 
    28 //zoom position is get_parameter_data(87) 
    29 static const struct { 
    30         int zp, fl; 
    31 } fl_tbl[] = { 
    32   {   0,   6100}, 
    33   {   1,   6800}, 
    34   {   2,   7400}, 
    35   {   3,   8100}, 
    36   {   4,   8900}, 
    37   {   5,   9800}, 
    38   {   6,   10800}, 
    39   {   7,   12100}, 
    40   {   8,   13800}, 
    41   {   9,   15700}, 
    42   {  10,   18100}, 
    43   {  11,   21500}, 
    44   {  12,   25000}, 
    45   {  13,   30500}, 
    46 }; 
     28// Focus length table in firmware @0xfffe2a8c 
     29#define NUM_FL      14  // 0 - 13, entries in firmware 
     30#define NUM_DATA    3   // 3 words each entry, first is FL 
     31extern int focus_len_table[NUM_FL*NUM_DATA]; 
    4732 
    48 #define NUM_FL (sizeof(fl_tbl)/sizeof(fl_tbl[0])) 
    49 // G11 focal lenght range 6.1 - 30.5 mm (35 mm equivalent: 27.8 - 139.1 mm)(1/1.7" Type CCD, Scale Factor To 35 mm Equivalent: 4.6) 
    50 // 27,8/6,1*10000=45574 
    51 // 139,1/30,5*10000=45607 
    52 #define CF_EFL 45574 
     33// Conversion factor lens FL --> 35mm equiv 
     34// lens      35mm     CF 
     35// ----      ----     -- 
     36// 6.1       28       ( 28/ 6.1) * 61 = 280  (min FL) 
     37// 30.5      140      (140/30.5) * 61 = 280  (max FL) 
     38#define CF_EFL      280 
     39#define CF_EFL_DIV  61 
    5340 
    5441const int zoom_points = NUM_FL; 
    5542 
    5643int get_effective_focal_length(int zp) { 
    57     return (CF_EFL*get_focal_length(zp))/10000; 
     44    return (CF_EFL*get_focal_length(zp))/CF_EFL_DIV; 
    5845} 
    5946 
    6047int get_focal_length(int zp) { 
    61         int i; 
    62  
    63         if (zp<fl_tbl[0].zp) 
    64                 return fl_tbl[0].fl; 
    65         else if (zp>fl_tbl[NUM_FL-1].zp) 
    66                 return fl_tbl[NUM_FL-1].fl; 
    67         else  
    68                 for (i=1; i<NUM_FL; ++i) { 
    69                         if (zp==fl_tbl[i-1].zp)  
    70                                 return fl_tbl[i-1].fl; 
    71                         else if (zp==fl_tbl[i].zp)  
    72                                 return fl_tbl[i].fl; 
    73                         else if (zp<fl_tbl[i].zp) 
    74                                 return fl_tbl[i-1].fl+(zp-fl_tbl[i-1].zp)*(fl_tbl[i].fl-fl_tbl[i-1].fl)/(fl_tbl[i].zp-fl_tbl[i-1].zp); 
    75                 } 
    76         return fl_tbl[NUM_FL-1].fl; 
     48    if (zp < 0) zp = 0; 
     49    else if (zp >= NUM_FL) zp = NUM_FL-1; 
     50    return focus_len_table[zp*NUM_DATA]; 
    7751} 
    7852 
    7953int get_zoom_x(int zp) { 
    80         return get_focal_length(zp)*10/fl_tbl[0].fl; 
     54    return get_focal_length(zp)*10/focus_len_table[0]; 
    8155} 
    82  
    8356 
    8457long get_vbatt_min() 
  • branches/reyalp-ptp-live/platform/g12/main.c

    r1565 r1814  
    3636} 
    3737 
    38 // Focus length table in firmware @ FFFE2A80 
    39 #define NUM_FL 14               // 0 - 13, entries in firmware (3 words each entry, first is FL) 
    40 extern int focus_len_table[NUM_FL*3]; 
     38// Focus length table in firmware @0xfffe2a80 
     39#define NUM_FL      14  // 0 - 13, entries in firmware 
     40#define NUM_DATA    3   // 3 words each entry, first is FL 
     41extern int focus_len_table[NUM_FL*NUM_DATA]; 
    4142 
    4243// Conversion factor lens FL --> 35mm equiv 
    4344// lens      35mm     CF 
    4445// ----      ----     -- 
    45 // 6.1       28       (28/6.1) * 61 = 280  (min FL) 
     46// 6.1       28       ( 28/ 6.1) * 61 = 280  (min FL) 
    4647// 30.5      140      (140/30.5) * 61 = 280  (max FL) 
    47 #define CF_EFL 280 
    48 #define CF_EFL_DIV 61 
     48#define CF_EFL      280 
     49#define CF_EFL_DIV  61 
    4950 
    50 const int zoom_points = NUM_FL;  // OK 
     51const int zoom_points = NUM_FL; 
    5152 
    5253int get_effective_focal_length(int zp) { 
    53         return (CF_EFL*get_focal_length(zp))/CF_EFL_DIV; 
     54    return (CF_EFL*get_focal_length(zp))/CF_EFL_DIV; 
    5455} 
    5556 
    5657int get_focal_length(int zp) { 
    57         if (zp < 0) zp = 0; 
    58         else if (zp >= NUM_FL) zp = NUM_FL-1; 
    59         return focus_len_table[zp*3]; 
     58    if (zp < 0) zp = 0; 
     59    else if (zp >= NUM_FL) zp = NUM_FL-1; 
     60    return focus_len_table[zp*NUM_DATA]; 
    6061} 
    6162 
    6263int get_zoom_x(int zp) { 
    63         return get_focal_length(zp)*10/focus_len_table[0]; 
     64    return get_focal_length(zp)*10/focus_len_table[0]; 
    6465} 
    6566 
  • branches/reyalp-ptp-live/platform/g12/sub/100c/stubs_entry.S

    r1641 r1814  
    4141DEF(focus_busy                              ,0x000070c0) // Found @0xff97d6c8 
    4242DEF(recreview_hold                          ,0x00003f50) // Found @0xff8a8134 
     43DEF(palette_control                         ,0x0000a5dc) // Found @0xffa53c24 
     44DEF(active_palette_buffer                   ,0x0000a5e4) // Found @0xffa53c28 
     45DEF(palette_buffer                          ,0x000bbf5c) // Found @0xffa5415c 
     46DEF(bitmap_buffer                           ,0x0000a618) // Found @0xffa57bb4 
     47DEF(active_bitmap_buffer                    ,0x0000a610) // Found @0xffa57bb8 
    4348 
    4449// Values below go in 'lib.c': 
  • branches/reyalp-ptp-live/platform/g12/sub/100c/stubs_min.S

    r1641 r1814  
    33DEF(rear_dial_position,                 0xC0240106) 
    44DEF(front_dial_position,                0xC0240306) 
    5 // bitmap_buffer & acive_bitmap_buffer (1.00c) 
    6 //      0xa610 = 0 or 1, used as index into 0xa618 
    7 //      0xa618 = 0x40471000 
    8 //      0xa61c = 0x404b0480 = 0x40471000 + bitmap size 
    9 DEF(active_bitmap_buffer,               0xA610)         // 0xA5FC+0x14 (1.00c sub_FFA57B64 -> FFA57B68 + FFA57BB8) 
    10 DEF(bitmap_buffer,                      0xA618)         // FFA57BB4 
    11 DEF(palette_control,                    0xA5DC)         // sub_FFA53CDC (1.00c) 
    12 DEF(active_palette_buffer,              0xA5E4)         // sub_FFA53C24 (1.00c) 
    13 DEF(palette_buffer,                     0xBBF5C)        // sub_FFA54118 (1.00c) 
    145DEF(viewport_buffers,                   0xFFBB822C)     // 1.00c sub_FF852148 (FF85243C) 
    156DEF(active_viewport_buffer,             0x20AC)         // 1.00c sub_FF852148 (FF85214C & FF852468) 
  • branches/reyalp-ptp-live/platform/g12/sub/100e/stubs_entry.S

    r1641 r1814  
    4141DEF(focus_busy                              ,0x000070c0) // Found @0xff97d6c8 
    4242DEF(recreview_hold                          ,0x00003f50) // Found @0xff8a8134 
     43DEF(palette_control                         ,0x0000a5dc) // Found @0xffa53c30 
     44DEF(active_palette_buffer                   ,0x0000a5e4) // Found @0xffa53c34 
     45DEF(palette_buffer                          ,0x000bbf5c) // Found @0xffa54168 
     46DEF(bitmap_buffer                           ,0x0000a618) // Found @0xffa57bc0 
     47DEF(active_bitmap_buffer                    ,0x0000a610) // Found @0xffa57bc4 
    4348 
    4449// Values below go in 'lib.c': 
  • branches/reyalp-ptp-live/platform/g12/sub/100e/stubs_min.S

    r1641 r1814  
    33DEF(rear_dial_position,                 0xC0240106) 
    44DEF(front_dial_position,                0xC0240306) 
    5 DEF(active_bitmap_buffer,               0xA610)         // 0xA5FC+0x14 (1.00e sub_FFA57B70 -> FFA57B74 + FFA57BC4) 
    6 DEF(bitmap_buffer,                      0xA618)         // FFA57BC0 
    7 DEF(palette_control,                    0xA5DC)         // sub_FFA53CDC (1.00c) 
    8 DEF(active_palette_buffer,              0xA5E4)         // sub_FFA53C24 (1.00c) 
    9 DEF(palette_buffer,                     0xBBF5C)        // sub_FFA54118 (1.00c) 
    105DEF(viewport_buffers,                   0xFFBB83DC)     // 1.00c sub_FF852148 (FF85243C) 
    116DEF(active_viewport_buffer,             0x20AC)         // 1.00c sub_FF852148 (FF85214C & FF852468) 
  • branches/reyalp-ptp-live/platform/g12/sub/100f/stubs_entry.S

    r1641 r1814  
    4141DEF(focus_busy                              ,0x000070c0) // Found @0xff97d6c8 
    4242DEF(recreview_hold                          ,0x00003f50) // Found @0xff8a8134 
     43DEF(palette_control                         ,0x0000a5dc) // Found @0xffa53c30 
     44DEF(active_palette_buffer                   ,0x0000a5e4) // Found @0xffa53c34 
     45DEF(palette_buffer                          ,0x000bbf5c) // Found @0xffa54168 
     46DEF(bitmap_buffer                           ,0x0000a618) // Found @0xffa57bc0 
     47DEF(active_bitmap_buffer                    ,0x0000a610) // Found @0xffa57bc4 
    4348 
    4449// Values below go in 'lib.c': 
  • branches/reyalp-ptp-live/platform/g12/sub/100f/stubs_min.S

    r1641 r1814  
    33DEF(rear_dial_position,                 0xC0240106) 
    44DEF(front_dial_position,                0xC0240306) 
    5 DEF(active_bitmap_buffer,               0xA610)         // 0xA5FC+0x14 (1.00f sub_FFA57B70 -> FFA57B74 + FFA57BC4) 
    6 DEF(bitmap_buffer,                      0xA618)         // FFA57BC0 
    7 DEF(palette_control,                    0xA5DC)         // sub_FFA53CDC (1.00c) 
    8 DEF(active_palette_buffer,              0xA5E4)         // sub_FFA53C24 (1.00c) 
    9 DEF(palette_buffer,                     0xBBF5C)        // sub_FFA54118 (1.00c) 
    105DEF(viewport_buffers,                   0xFFBB83CC)     // 1.00c sub_FF852148 (FF85243C) 
    116DEF(active_viewport_buffer,             0x20AC)         // 1.00c sub_FF852148 (FF85214C & FF852468) 
  • branches/reyalp-ptp-live/platform/g12/sub/100g/stubs_entry.S

    r1641 r1814  
    4141DEF(focus_busy                              ,0x000070c0) // Found @0xff97d6c8 
    4242DEF(recreview_hold                          ,0x00003f50) // Found @0xff8a8134 
     43DEF(palette_control                         ,0x0000a5dc) // Found @0xffa53c30 
     44DEF(active_palette_buffer                   ,0x0000a5e4) // Found @0xffa53c34 
     45DEF(palette_buffer                          ,0x000bbf5c) // Found @0xffa54168 
     46DEF(bitmap_buffer                           ,0x0000a618) // Found @0xffa57bc0 
     47DEF(active_bitmap_buffer                    ,0x0000a610) // Found @0xffa57bc4 
    4348 
    4449// Values below go in 'lib.c': 
  • branches/reyalp-ptp-live/platform/g12/sub/100g/stubs_min.S

    r1641 r1814  
    33DEF(rear_dial_position,                 0xC0240106) 
    44DEF(front_dial_position,                0xC0240306) 
    5 DEF(active_bitmap_buffer,               0xA610)         // 0xA5FC+0x14 (1.00g sub_FFA57B70 -> FFA57B74 + FFA57BC4) 
    6 DEF(bitmap_buffer,                      0xA618)         // FFA57BC0 
    7 DEF(palette_control,                    0xA5DC)         // sub_FFA53CDC (1.00c) 
    8 DEF(active_palette_buffer,              0xA5E4)         // sub_FFA53C24 (1.00c) 
    9 DEF(palette_buffer,                     0xBBF5C)        // sub_FFA54118 (1.00c) 
    105DEF(viewport_buffers,                   0xFFBB83B8)     // 1.00c sub_FF852148 (FF85243C) 
    116DEF(active_viewport_buffer,             0x20AC)         // 1.00c sub_FF852148 (FF85214C & FF852468) 
  • branches/reyalp-ptp-live/platform/ixus1000_sd4500/main.c

    r1385 r1814  
    3131} 
    3232 
     33// Focus length table in firmware @0xfffe9eac 
     34#define NUM_FL      101 // 0 - 100, entries in firmware 
     35#define NUM_DATA    3   // 3 words each entry, first is FL 
     36extern int focus_len_table[NUM_FL*NUM_DATA]; 
    3337 
    34 //zoom position is get_parameter_data(87) 
     38// Conversion factor lens FL --> 35mm equiv 
     39// lens      35mm     CF 
     40// ----      ----     -- 
     41// 6.3       36       ( 36/ 6.3) * 63 = 360  (min FL) 
     42// 63.0      360      (360/63.0) * 63 = 360  (max FL) 
     43#define CF_EFL      360 
     44#define CF_EFL_DIV  63 
    3545 
    36 // Ixus 1000 576 =1 
    37 static const struct { 
    38         int zp, fl; 
    39 } fl_tbl[] = { 
    40   {   0,   6300}, 
    41   {   5,  5*576+6300}, 
    42   {   10, 10*576+6300}, 
    43   {  20,  20*576+6300}, 
    44   {  30,  30*576+6300}, 
    45   {  40,  40*576+6300}, 
    46   {  50,  50*576+6300}, 
    47   {  60,  60*576+6300}, 
    48   {  70,  70*576+6300}, 
    49   {  80,  80*576+6300}, 
    50   {  90,  90*576+6300}, 
    51   { 100,  63000}, 
    52 }; 
    53 #define NUM_FL (sizeof(fl_tbl)/sizeof(fl_tbl[0])) 
    54  
    55 // Focal length range is 6.3 - 63,0 mm, 36.0 - 360 in 35-mm equivalent. for Ixus 1000 HS 
    56  
    57 // Focal length range is 6.0 - 70,0 mm, 27.3 - 392 in 35-mm equivalent. for Sx210 
    58 // So, CF_EFL = 27.3/5.0*10000=54600 or392/70*10000=56000 
    59 // diff = 54600 - 54566.6 = 1400, split it 1400 / 2 = 700 
    60 // add to base 56000 + 700 = 56700 
    61 // divide by 10 to avoid overflow in get_effective_focal_length() 
    62 #define CF_EFL  5714 
    63 const int zoom_points = 100; 
     46const int zoom_points = NUM_FL; 
    6447 
    6548int get_effective_focal_length(int zp) { 
    66         return (CF_EFL*get_focal_length(zp))/1000; 
     49    return (CF_EFL*get_focal_length(zp))/CF_EFL_DIV; 
    6750} 
    6851 
    6952int get_focal_length(int zp) { 
    70         int i; 
    71  
    72         if (zp<fl_tbl[0].zp) 
    73                 return fl_tbl[0].fl; 
    74         else if (zp>fl_tbl[NUM_FL-1].zp) 
    75                 return fl_tbl[NUM_FL-1].fl; 
    76         else 
    77                 for (i=1; i<NUM_FL; ++i) { 
    78                         if (zp==fl_tbl[i-1].zp) 
    79                                 return fl_tbl[i-1].fl; 
    80                         else if (zp==fl_tbl[i].zp) 
    81                                 return fl_tbl[i].fl; 
    82                         else if (zp<fl_tbl[i].zp) 
    83                                 return fl_tbl[i-1].fl+(zp-fl_tbl[i-1].zp)*(fl_tbl[i].fl-fl_tbl[i-1].fl)/(fl_tbl[i].zp-fl_tbl[i-1].zp); 
    84                 } 
    85         return fl_tbl[NUM_FL-1].fl; 
     53    if (zp < 0) zp = 0; 
     54    else if (zp >= NUM_FL) zp = NUM_FL-1; 
     55    return focus_len_table[zp*NUM_DATA]; 
    8656} 
    8757 
    8858int get_zoom_x(int zp) { 
    89         return get_focal_length(zp)*10/fl_tbl[0].fl; 
     59    return get_focal_length(zp)*10/focus_len_table[0]; 
    9060} 
    91  
    9261 
    9362long get_vbatt_min() 
  • branches/reyalp-ptp-live/platform/ixus1000_sd4500/platform_camera.h

    r1813 r1814  
    3737 
    3838    #undef  CAM_CAN_SD_OVER_NOT_IN_MF 
     39    #define CAM_USE_ZOOM_FOR_MF             1 
     40    #define CAM_CAN_SD_OVER_IN_AF_LOCK      1 
     41     
    3942    #undef  CAM_CAN_UNLOCK_OPTICAL_ZOOM_IN_VIDEO 
    4043 
  • branches/reyalp-ptp-live/platform/ixus1000_sd4500/sub/100d/stubs_entry.S

    r1641 r1814  
    4242DEF(focus_busy                              ,0x00007394) // Found @0xff972b30 
    4343//DEF(recreview_hold                          ,0x00004294) // Found @0xff8a8800, ** != ** stubs_min = 0x000087e0 (0x86F4+0xEC) 
     44DEF(palette_control                         ,0x0000a338) // Found @0xffa2bd68 
     45DEF(active_palette_buffer                   ,0x0000a340) // Found @0xffa2bd6c 
     46DEF(palette_buffer                          ,0x000b84ac) // Found @0xffa2c2a0 
     47DEF(bitmap_buffer                           ,0x0000a374) // Found @0xffa30f50 
     48DEF(active_bitmap_buffer                    ,0x0000a36c) // Found @0xffa30f54 
    4449 
    4550// Values below go in 'lib.c': 
  • branches/reyalp-ptp-live/platform/ixus1000_sd4500/sub/100f/stubs_entry.S

    r1641 r1814  
    4242DEF(focus_busy                              ,0x00007394) // Found @0xff972b30 
    4343//DEF(recreview_hold                          ,0x00004294) // Found @0xff8a8800, ** != ** stubs_min = 0x000087e8 (0x86FC+0xEC) 
     44DEF(palette_control                         ,0x0000a340) // Found @0xffa2bd6c 
     45DEF(active_palette_buffer                   ,0x0000a348) // Found @0xffa2bd70 
     46DEF(palette_buffer                          ,0x000b84ac) // Found @0xffa2c2a4 
     47DEF(bitmap_buffer                           ,0x0000a37c) // Found @0xffa30f54 
     48DEF(active_bitmap_buffer                    ,0x0000a374) // Found @0xffa30f58 
    4449 
    4550// Values below go in 'lib.c': 
  • branches/reyalp-ptp-live/platform/ixus100_sd780/main.c

    r1720 r1814  
    6666#define MODESCNT (sizeof(modemap)/sizeof(modemap[0])) 
    6767 
    68 //SD780 is [f/3.2 is 6mm] [f/3.5 7mm] [f/4.5 11mm] [f/5   15mm] [f/5.8 18mm] 
    69 //SD780 is 5.9-17.9mm f/3.2-5.8 (35mm film equivalent: 33-100mm) 
    70 static const int fl_tbl[] = {5900,7170,8740,10550,12490,14780,17900}; 
    71 #define NUM_FL (sizeof(fl_tbl)/sizeof(fl_tbl[0])) 
    72 #define CF_EFL 55932 
     68// Focus length table in firmware @0xfffe2a8c 
     69#define NUM_FL      7   // 0 - 6, entries in firmware 
     70#define NUM_DATA    3   // 3 words each entry, first is FL 
     71extern int focus_len_table[NUM_FL*NUM_DATA]; 
     72 
     73// Conversion factor lens FL --> 35mm equiv 
     74// lens      35mm     CF 
     75// ----      ----     -- 
     76// 5.9       33       ( 33/ 5.9) * 59 = 330  (min FL) 
     77// 17.9      100      (100/17.9) * 59 = 329.6  (max FL) 
     78#define CF_EFL      330 
     79#define CF_EFL_DIV  59 
    7380 
    7481const int zoom_points = NUM_FL; 
    7582 
    7683int get_effective_focal_length(int zp) { 
    77     return (CF_EFL*get_focal_length(zp))/10000; 
     84    return (CF_EFL*get_focal_length(zp))/CF_EFL_DIV; 
    7885} 
    7986 
    8087int get_focal_length(int zp) { 
    81     if (zp<0) return fl_tbl[0]; 
    82     else if (zp>NUM_FL-1) return fl_tbl[NUM_FL-1]; 
    83     else return fl_tbl[zp]; 
     88    if (zp < 0) zp = 0; 
     89    else if (zp >= NUM_FL) zp = NUM_FL-1; 
     90    return focus_len_table[zp*NUM_DATA]; 
    8491} 
    8592 
    8693int get_zoom_x(int zp) { 
    87     if (zp<1) return 10; 
    88     else if (zp>NUM_FL-1) return fl_tbl[NUM_FL-1]*10/fl_tbl[0]; 
    89     else return fl_tbl[zp]*10/fl_tbl[0]; 
     94    return get_focal_length(zp)*10/focus_len_table[0]; 
    9095} 
    9196 
  • branches/reyalp-ptp-live/platform/ixus120_sd940/main.c

    r1421 r1814  
    2828} 
    2929 
     30// Focus length table in firmware @0xfffe2a8c 
     31#define NUM_FL      10  // 0 - 9, entries in firmware 
     32#define NUM_DATA    3   // 3 words each entry, first is FL 
     33extern int focus_len_table[NUM_FL*NUM_DATA]; 
    3034 
    31  
    32 static const int fl_tbl[] = {5000, 6000, 7000, 8000, 9500, 10900, 12800,15000,173000,20000}; 
    33 #define NUM_FL (sizeof(fl_tbl)/sizeof(fl_tbl[0])) 
    34 // SD940 focal length range is 5 - 20 mm 
    35 // So, CF_EFL = 15/5*10000=30000 
    36 #define CF_EFL 30000 
     35// Conversion factor lens FL --> 35mm equiv 
     36// lens      35mm     CF 
     37// ----      ----     -- 
     38// 5.0       28       ( 28/ 5.0) * 50 = 280  (min FL) 
     39// 20.0      112      (112/20.0) * 50 = 280  (max FL) 
     40#define CF_EFL      280 
     41#define CF_EFL_DIV  50 
    3742 
    3843const int zoom_points = NUM_FL; 
    3944 
    4045int get_effective_focal_length(int zp) { 
    41     return (CF_EFL*get_focal_length(zp))/10000; 
     46    return (CF_EFL*get_focal_length(zp))/CF_EFL_DIV; 
    4247} 
    4348 
    4449int get_focal_length(int zp) { 
    45     if (zp<0) return fl_tbl[0]; 
    46     else if (zp>NUM_FL-1) return fl_tbl[NUM_FL-1]; 
    47     else return fl_tbl[zp]; 
     50    if (zp < 0) zp = 0; 
     51    else if (zp >= NUM_FL) zp = NUM_FL-1; 
     52    return focus_len_table[zp*NUM_DATA]; 
    4853} 
    4954 
    5055int get_zoom_x(int zp) { 
    51     if (zp<1) return 10; 
    52     else if (zp>NUM_FL-1) return fl_tbl[NUM_FL-1]*10/fl_tbl[0]; 
    53     else return fl_tbl[zp]*10/fl_tbl[0]; 
     56    return get_focal_length(zp)*10/focus_len_table[0]; 
    5457} 
    5558 
  • branches/reyalp-ptp-live/platform/ixus120_sd940/platform_camera.h

    r1711 r1814  
    3838    #define CAM_UNCACHED_BIT                0x40000000 
    3939    #define CAM_HAS_ND_FILTER               1 
    40  
     40    #undef CAM_HAS_ERASE_BUTTON    // Camera does not have a dedicated erase button 
     41    
    4142    #define CAM_DNG_LENS_INFO               { 50,10, 200,10, 28,10, 59,10 } // See comments in camera.h 
    4243    // pattern 
  • branches/reyalp-ptp-live/platform/ixus200_sd980/main.c

    r1212 r1814  
    2828} 
    2929 
     30// Focus length table in firmware @0xfffe2ac8 
     31#define NUM_FL      12  // 0 - 11, entries in firmware 
     32#define NUM_DATA    3   // 3 words each entry, first is FL 
     33extern int focus_len_table[NUM_FL*NUM_DATA]; 
    3034 
    31  
    32 static const int fl_tbl[] = {4000, 5000, 6000, 7000, 8000, 9000, 11000, 13000,15000,18000,22000}; 
    33 #define NUM_FL (sizeof(fl_tbl)/sizeof(fl_tbl[0])) 
    34 // SD980 focal length range is 4 - 22 mm 
    35 // So, CF_EFL = 22/4*10000=55000 
    36 #define CF_EFL 55000 
     35// Conversion factor lens FL --> 35mm equiv 
     36// lens      35mm     CF 
     37// ----      ----     -- 
     38// 4.3       24       ( 24/ 4.3) * 43 = 240  (min FL) 
     39// 21.5      120      (120/21.5) * 43 = 240  (max FL) 
     40#define CF_EFL      240 
     41#define CF_EFL_DIV  43 
    3742 
    3843const int zoom_points = NUM_FL; 
    3944 
    4045int get_effective_focal_length(int zp) { 
    41     return (CF_EFL*get_focal_length(zp))/10000; 
     46    return (CF_EFL*get_focal_length(zp))/CF_EFL_DIV; 
    4247} 
    4348 
    4449int get_focal_length(int zp) { 
    45     if (zp<0) return fl_tbl[0]; 
    46     else if (zp>NUM_FL-1) return fl_tbl[NUM_FL-1]; 
    47     else return fl_tbl[zp]; 
     50    if (zp < 0) zp = 0; 
     51    else if (zp >= NUM_FL) zp = NUM_FL-1; 
     52    return focus_len_table[zp*NUM_DATA]; 
    4853} 
    4954 
    5055int get_zoom_x(int zp) { 
    51     if (zp<1) return 10; 
    52     else if (zp>NUM_FL-1) return fl_tbl[NUM_FL-1]*10/fl_tbl[0]; 
    53     else return fl_tbl[zp]*10/fl_tbl[0]; 
     56    return get_focal_length(zp)*10/focus_len_table[0]; 
    5457} 
    5558 
  • branches/reyalp-ptp-live/platform/ixus200_sd980/platform_camera.h

    r1711 r1814  
    3535    #define CAM_BRACKETING                  1 
    3636    #undef  CAM_VIDEO_CONTROL 
    37     #undef  CAM_HAS_IRIS_DIAPHRAGM 
    3837    #define CAM_MULTIPART                   1 
    3938    #define CAM_HAS_JOGDIAL                 1 
  • branches/reyalp-ptp-live/platform/ixus220_elph300hs/main.c

    r1448 r1814  
    3030 
    3131// Focus length table in firmware @0xfffea288 
    32 #define NUM_FL 60               // 0 - 59, entries in firmware (3 words each entry, first is FL) 
    33 extern int focus_len_table[NUM_FL*3]; 
     32#define NUM_FL      64  // 0 - 63, entries in firmware 
     33#define NUM_DATA    3   // 3 words each entry, first is FL 
     34extern int focus_len_table[NUM_FL*NUM_DATA]; 
    3435 
     36// Conversion factor lens FL --> 35mm equiv 
     37// lens      35mm     CF 
     38// ----      ----     -- 
     39// 4.3       24       ( 24/ 4.3) * 43 = 240  (min FL) 
     40// 21.5      120      (120/21.5) * 43 = 240  (max FL) 
     41#define CF_EFL      240 
     42#define CF_EFL_DIV  43 
    3543 
    36 // Focal length range is 4.3 - 21.5 mm, 24 - 120 in 35-mm equivalent. 
    37 // So, CF_EFL = 21.5/4.3*10000=50000 or 120/24*10000=50000 
    38 // divide by 10 to avoid overflow in get_effective_focal_length() 
    39 #define CF_EFL  5000 
    40 const int zoom_points = 60; 
     44const int zoom_points = NUM_FL; 
    4145 
    4246int get_effective_focal_length(int zp) { 
    43         return (CF_EFL*get_focal_length(zp))/1000; 
     47    return (CF_EFL*get_focal_length(zp))/CF_EFL_DIV; 
    4448} 
    4549 
    4650int get_focal_length(int zp) { 
    47         if (zp < 0) zp = 0; 
    48         else if (zp >= NUM_FL) zp = NUM_FL-1; 
    49         return focus_len_table[zp*3]; 
    50          
     51    if (zp < 0) zp = 0; 
     52    else if (zp >= NUM_FL) zp = NUM_FL-1; 
     53    return focus_len_table[zp*NUM_DATA]; 
    5154} 
    5255 
    5356int get_zoom_x(int zp) { 
    54         return get_focal_length(zp)*10/focus_len_table[0]; 
     57    return get_focal_length(zp)*10/focus_len_table[0]; 
    5558} 
    56  
    5759 
    5860long get_vbatt_min() 
  • branches/reyalp-ptp-live/platform/ixus220_elph300hs/sub/100c/stubs_entry.S

    r1813 r1814  
    4141DEF(focus_busy                              ,0x00006b68) // Found @0xff97af60 
    4242DEF(recreview_hold                          ,0x00003828) // Found @0xff8a6510 
     43DEF(palette_control                         ,0x00009d00) // Found @0xffa32d78 
     44DEF(active_palette_buffer                   ,0x00009d08) // Found @0xffa32d7c 
     45DEF(palette_buffer                          ,0x000bb254) // Found @0xffa33254 
     46DEF(bitmap_buffer                           ,0x00009d40) // Found @0xffa36ca0 
     47DEF(active_bitmap_buffer                    ,0x00009d38) // Found @0xffa36ca4 
    4348 
    4449// Values below go in 'lib.c': 
  • branches/reyalp-ptp-live/platform/ixus220_elph300hs/sub/101a/stubs_entry.S

    r1813 r1814  
    4141DEF(focus_busy                              ,0x00006b68) // Found @0xff97af60 
    4242DEF(recreview_hold                          ,0x00003828) // Found @0xff8a6510 
     43DEF(palette_control                         ,0x00009d00) // Found @0xffa32d78 
     44DEF(active_palette_buffer                   ,0x00009d08) // Found @0xffa32d7c 
     45DEF(palette_buffer                          ,0x000bb254) // Found @0xffa33254 
     46DEF(bitmap_buffer                           ,0x00009d40) // Found @0xffa36ca0 
     47DEF(active_bitmap_buffer                    ,0x00009d38) // Found @0xffa36ca4 
    4348 
    4449// Values below go in 'lib.c': 
  • branches/reyalp-ptp-live/platform/ixus220_elph300hs/sub/101c/stubs_entry.S

    r1813 r1814  
    4141DEF(focus_busy                              ,0x00006b68) // Found @0xff97af60 
    4242DEF(recreview_hold                          ,0x00003828) // Found @0xff8a6510 
     43DEF(palette_control                         ,0x00009d00) // Found @0xffa32d78 
     44DEF(active_palette_buffer                   ,0x00009d08) // Found @0xffa32d7c 
     45DEF(palette_buffer                          ,0x000bb254) // Found @0xffa33254 
     46DEF(bitmap_buffer                           ,0x00009d40) // Found @0xffa36ca0 
     47DEF(active_bitmap_buffer                    ,0x00009d38) // Found @0xffa36ca4 
    4348 
    4449// Values below go in 'lib.c': 
  • branches/reyalp-ptp-live/platform/ixus220_elph300hs/sub/101g/stubs_entry.S

    r1813 r1814  
    4141DEF(focus_busy                              ,0x00006b68) // Found @0xff97af60 
    4242DEF(recreview_hold                          ,0x00003828) // Found @0xff8a6510 
     43DEF(palette_control                         ,0x00009d00) // Found @0xffa32d78 
     44DEF(active_palette_buffer                   ,0x00009d08) // Found @0xffa32d7c 
     45DEF(palette_buffer                          ,0x000bb254) // Found @0xffa33254 
     46DEF(bitmap_buffer                           ,0x00009d40) // Found @0xffa36ca0 
     47DEF(active_bitmap_buffer                    ,0x00009d38) // Found @0xffa36ca4 
    4348 
    4449// Values below go in 'lib.c': 
  • branches/reyalp-ptp-live/platform/ixus230_elph310hs/main.c

    r1567 r1814  
    2929} 
    3030 
    31 // Focus length table in firmware @0xFFF4ABC8 
    32 #define NUM_FL 127 
    33 extern int focus_len_table[NUM_FL*3]; 
     31// Focus length table in firmware @0xfff4abc8 
     32#define NUM_FL      127 // 0 - 126, entries in firmware 
     33#define NUM_DATA    2   // 2 words each entry, first is FL 
     34extern int focus_len_table[NUM_FL*NUM_DATA]; 
    3435 
     36// Conversion factor lens FL --> 35mm equiv 
     37// lens      35mm     CF 
     38// ----      ----     -- 
     39// 5.0       28       ( 28/ 5.0) * 50 = 280  (min FL) 
     40// 40.0      224      (224/40.0) * 50 = 280  (max FL) 
     41#define CF_EFL      280 
     42#define CF_EFL_DIV  50 
    3543 
    36 // Focal length range is 5.0 - 40.0 mm, 28 - 224 in 35-mm equivalent. 
    37 // So, CF_EFL = 28/5*10000=56000 or 224/40*10000=56000 
    38 // divide by 10 to avoid overflow in get_effective_focal_length() 
    39 #define CF_EFL  5600 
    4044const int zoom_points = NUM_FL; 
    4145 
    4246int get_effective_focal_length(int zp) { 
    43         return (CF_EFL*get_focal_length(zp))/1000; 
     47    return (CF_EFL*get_focal_length(zp))/CF_EFL_DIV; 
    4448} 
    4549 
    4650int get_focal_length(int zp) { 
    47         if (zp < 0) zp = 0; 
    48         else if (zp >= NUM_FL) zp = NUM_FL-1; 
    49         return focus_len_table[zp*3]; 
    50          
     51    if (zp < 0) zp = 0; 
     52    else if (zp >= NUM_FL) zp = NUM_FL-1; 
     53    return focus_len_table[zp*NUM_DATA]; 
    5154} 
    5255 
    5356int get_zoom_x(int zp) { 
    54         return get_focal_length(zp)*10/focus_len_table[0]; 
     57    return get_focal_length(zp)*10/focus_len_table[0]; 
    5558} 
    56  
    5759 
    5860long get_vbatt_min() 
  • branches/reyalp-ptp-live/platform/ixus230_elph310hs/sub/100b/stubs_entry.S

    r1658 r1814  
    4040DEF(focus_busy                              ,0x00006a40) // Found @0xff17aa94 
    4141DEF(recreview_hold                          ,0x000038ec) // Found @0xff09a5d4 
     42DEF(palette_control                         ,0x00009a2c) // Found @0xff22fc38 
     43DEF(active_palette_buffer                   ,0x00009a34) // Found @0xff22fc3c 
     44DEF(palette_buffer                          ,0x000b9c80) // Found @0xff230104 
     45DEF(bitmap_buffer                           ,0x00009a70) // Found @0xff233948 
     46DEF(active_bitmap_buffer                    ,0x00009a68) // Found @0xff23394c 
    4247 
    4348// Values below go in 'lib.c': 
  • branches/reyalp-ptp-live/platform/ixus300_sd4000/main.c

    r1377 r1814  
    3333} 
    3434 
    35 // F/2.0 - 5.3 
    36 // 4.9 - 18.6mm 
    37 static const int fl_tbl[] = {5800, 6420, 7060, 7700, 8340, 9950, 11550, 13160, 14750, 17150, 19570, 22760, 26750, 30750, 34800};    // ToDo, convert a focus position to a focal length (* 1000), http://chdk.setepontos.com/index.php?topic=5722.msg59333#msg59333 
    38 #define NUM_FL (sizeof(fl_tbl)/sizeof(fl_tbl[0])) 
    39 #define CF_EFL 60345    // ToDo, convert a camera focal length to a 35mm effective focal length, http://chdk.setepontos.com/index.php?topic=5722.msg59333#msg59333 
     35// Focus length table in firmware @0xfffe9718  
     36#define NUM_FL      64  // 0 - 63, entries in firmware 
     37#define NUM_DATA    3   // 3 words each entry, first is FL 
     38extern int focus_len_table[NUM_FL*NUM_DATA]; 
     39 
     40// Conversion factor lens FL --> 35mm equiv 
     41// lens      35mm     CF 
     42// ----      ----     -- 
     43// 4.9       28       ( 28/ 4.9) * 49 = 280  (min FL) 
     44// 18.6      105      (105/18.6) * 49 = 276.6  (max FL) 
     45#define CF_EFL      280 
     46#define CF_EFL_DIV  49 
    4047 
    4148const int zoom_points = NUM_FL; 
    4249 
    43 // ToDo, http://chdk.setepontos.com/index.php?topic=5722.msg59333#msg59333 
    4450int get_effective_focal_length(int zp) { 
    45     return (CF_EFL*get_focal_length(zp))/10000; 
     51    return (CF_EFL*get_focal_length(zp))/CF_EFL_DIV; 
    4652} 
    4753 
    48 // ToDo 
    4954int get_focal_length(int zp) { 
    50     if (zp<0) return fl_tbl[0]; 
    51     else if (zp>NUM_FL-1) return fl_tbl[NUM_FL-1]; 
    52     else return fl_tbl[zp]; 
     55    if (zp < 0) zp = 0; 
     56    else if (zp >= NUM_FL) zp = NUM_FL-1; 
     57    return focus_len_table[zp*NUM_DATA]; 
    5358} 
    5459 
    55 // ToDo 
    5660int get_zoom_x(int zp) { 
    57     if (zp<1) return 10; 
    58     else if (zp>NUM_FL-1) return fl_tbl[NUM_FL-1]*10/fl_tbl[0]; 
    59     else return fl_tbl[zp]*10/fl_tbl[0]; 
     61    return get_focal_length(zp)*10/focus_len_table[0]; 
    6062} 
    6163 
  • branches/reyalp-ptp-live/platform/ixus300_sd4000/platform_camera.h

    r1711 r1814  
    5656 
    5757    #define PARAM_CAMERA_NAME               4        // parameter number for GetParameterData to get camera name 
     58 
     59    #undef  DNG_BADPIXEL_VALUE_LIMIT 
     60    #define DNG_BADPIXEL_VALUE_LIMIT        16      // Camera sensor apparently has bad pixels with value > 0 & <=16 
    5861 
    5962    #define CAM_DNG_LENS_INFO               { 49,10, 186,10, 20,10, 53,10 } // See comments in camera.h 
  • branches/reyalp-ptp-live/platform/ixus310_elph500hs/main.c

    r1339 r1814  
    2828} 
    2929 
    30 // Focus length table in firmware @ 0xFFF4A30C 
    31 #define NUM_FL 64               // 0 - 63, entries in firmware (3 words each entry, first is FL) 
    32 extern int focus_len_table[NUM_FL*3]; 
     30// Focus length table in firmware @0xfff4a30c 
     31#define NUM_FL      64  // 0 - 63, entries in firmware 
     32#define NUM_DATA    3   // 3 words each entry, first is FL 
     33extern int focus_len_table[NUM_FL*NUM_DATA]; 
    3334 
    3435// Conversion factor lens FL --> 35mm equiv 
    3536// lens      35mm     CF 
    3637// ----      ----     -- 
    37 // 4.3       24       (24/4.3) * 430 = 2400  (min FL) 
    38 // 18.8      105      (105/18.8) * 430 = 2401.6  (max FL) 
    39 #define CF_EFL 2402     // rounded up 
    40 #define CF_EFL_DIV 430 
     38// 4.3       24       ( 24/ 4.3) * 43 = 240  (min FL) 
     39// 18.8      105      (105/18.8) * 43 = 240.2  (max FL) 
     40#define CF_EFL      240 
     41#define CF_EFL_DIV  43 
    4142 
    42 const int zoom_points = NUM_FL;  // OK 
     43const int zoom_points = NUM_FL; 
    4344 
    4445int get_effective_focal_length(int zp) { 
    45         return (CF_EFL*get_focal_length(zp))/CF_EFL_DIV; 
     46    return (CF_EFL*get_focal_length(zp))/CF_EFL_DIV; 
    4647} 
    4748 
    4849int get_focal_length(int zp) { 
    49         if (zp < 0) zp = 0; 
    50         else if (zp >= NUM_FL) zp = NUM_FL-1; 
    51         return focus_len_table[zp*3]; 
     50    if (zp < 0) zp = 0; 
     51    else if (zp >= NUM_FL) zp = NUM_FL-1; 
     52    return focus_len_table[zp*NUM_DATA]; 
    5253} 
    5354 
    5455int get_zoom_x(int zp) { 
    55         return get_focal_length(zp)*10/focus_len_table[0]; 
     56    return get_focal_length(zp)*10/focus_len_table[0]; 
    5657} 
    5758 
  • branches/reyalp-ptp-live/platform/ixus310_elph500hs/sub/100a/stubs_entry.S

    r1658 r1814  
    4242DEF(focus_busy                              ,0x00006e70) // Found @0xff173e9c 
    4343DEF(recreview_hold                          ,0x0000391c) // Found @0xff098530 
     44DEF(palette_control                         ,0x0000a424) // Found @0xff244990 
     45DEF(active_palette_buffer                   ,0x0000a42c) // Found @0xff244994 
     46DEF(palette_buffer                          ,0x000c7dec) // Found @0xff244e6c 
     47DEF(bitmap_buffer                           ,0x0000a464) // Found @0xff249aec 
     48DEF(active_bitmap_buffer                    ,0x0000a45c) // Found @0xff249af0 
    4449 
    4550// Values below go in 'lib.c': 
  • branches/reyalp-ptp-live/platform/ixus310_elph500hs/sub/100a/stubs_min.S

    r1641 r1814  
    11#include "stubs_asm.h" 
    22 
    3 DEF(active_bitmap_buffer,               0xA45C)         // 0xA448+0x14 (1.00a sub_FF249A94 -> FF249A98 + FF249AF0) 
    4 DEF(bitmap_buffer,                      0xA464)         // FF249AEC (1.00a) 
    5 DEF(palette_control,                    0xA424)         // sub_FF244A48 (1.00a) 
    6 DEF(active_palette_buffer,              0xA42C)         // sub_FF244990 (1.00a) 
    7 DEF(palette_buffer,                     0xC7DEC)        // sub_FF244E28 (1.00a) 
    83DEF(viewport_buffers,                   0xFF3D0418)     // 1.00a sub_FF0435C8 (FF043978) 
    94DEF(active_viewport_buffer,             0x2104)         // 1.00a sub_FF0435C8 (FF0435CC & FF043A28) 
  • branches/reyalp-ptp-live/platform/ixus310_elph500hs/sub/101a/stubs_entry.S

    r1658 r1814  
    4242DEF(focus_busy                              ,0x00006e70) // Found @0xff173e9c 
    4343DEF(recreview_hold                          ,0x0000391c) // Found @0xff098530 
     44DEF(palette_control                         ,0x0000a424) // Found @0xff244990 
     45DEF(active_palette_buffer                   ,0x0000a42c) // Found @0xff244994 
     46DEF(palette_buffer                          ,0x000c7dec) // Found @0xff244e6c 
     47DEF(bitmap_buffer                           ,0x0000a464) // Found @0xff249aec 
     48DEF(active_bitmap_buffer                    ,0x0000a45c) // Found @0xff249af0 
    4449 
    4550// Values below go in 'lib.c': 
  • branches/reyalp-ptp-live/platform/ixus310_elph500hs/sub/101a/stubs_min.S

    r1641 r1814  
    11#include "stubs_asm.h" 
    22 
    3 DEF(active_bitmap_buffer,               0xA45C)         // 0xA448+0x14 (1.01a sub_FF249A94 -> FF249A98 + FF249AF0) 
    4 DEF(bitmap_buffer,                      0xA464)         // FF249AEC (1.00a) 
    5 DEF(palette_control,                    0xA424)         // sub_FF244A48 (1.00a) 
    6 DEF(active_palette_buffer,              0xA42C)         // sub_FF244990 (1.00a) 
    7 DEF(palette_buffer,                     0xC7DEC)        // sub_FF244E28 (1.00a) 
    83DEF(viewport_buffers,                   0xFF3D0418)     // 1.00a sub_FF0435C8 (FF043978) 
    94DEF(active_viewport_buffer,             0x2104)         // 1.00a sub_FF0435C8 (FF0435CC & FF043A28) 
  • branches/reyalp-ptp-live/platform/ixus310_elph500hs/sub/101c/stubs_entry.S

    r1658 r1814  
    4242DEF(focus_busy                              ,0x00006e70) // Found @0xff173e9c 
    4343DEF(recreview_hold                          ,0x0000391c) // Found @0xff098530 
     44DEF(palette_control                         ,0x0000a424) // Found @0xff244990 
     45DEF(active_palette_buffer                   ,0x0000a42c) // Found @0xff244994 
     46DEF(palette_buffer                          ,0x000c7dec) // Found @0xff244e6c 
     47DEF(bitmap_buffer                           ,0x0000a464) // Found @0xff249aec 
     48DEF(active_bitmap_buffer                    ,0x0000a45c) // Found @0xff249af0 
    4449 
    4550// Values below go in 'lib.c': 
  • branches/reyalp-ptp-live/platform/ixus310_elph500hs/sub/101c/stubs_min.S

    r1449 r1814  
    1111DEF(cds_gain_value                                                      ,0x0000abd0) 
    1212 
    13 DEF(active_bitmap_buffer, 0xA45C)                                       // 0xA448+0x14 (1.01a sub_FF249A94 -> FF249A98 + FF249AF0) 
    14 DEF(bitmap_buffer, 0xA464)                                                      // FF249AEC (1.00a) 
    15 DEF(palette_control, 0xA424)                                            // sub_FF244A48 (1.00a) 
    16 DEF(active_palette_buffer, 0xA42C)                                      // sub_FF244990 (1.00a) 
    17 DEF(palette_buffer, 0xC7DEC)                                            // sub_FF244E28 (1.00a) 
    1813DEF(viewport_buffers, 0xFF3D0428)                       // 1.00a sub_FF0435C8 (FF043978) 
    1914DEF(active_viewport_buffer, 0x2104)                     // 1.00a sub_FF0435C8 (FF0435CC & FF043A28) 
  • branches/reyalp-ptp-live/platform/ixus85_sd770/main.c

    r1376 r1814  
    2626} 
    2727 
     28// Focus length table in firmware @0xfffe297c 
     29#define NUM_FL      7   // 0 - 6, entries in firmware 
     30#define NUM_DATA    3   // 3 words each entry, first is FL 
     31extern int focus_len_table[NUM_FL*NUM_DATA]; 
    2832 
    29 static const int fl_tbl[] = {6200, 7230, 8295, 9681, 11614, 14303, 18600}; 
    30 #define NUM_FL (sizeof(fl_tbl)/sizeof(fl_tbl[0])) 
    31 #define CF_EFL 56460 
     33// Conversion factor lens FL --> 35mm equiv 
     34// lens      35mm     CF 
     35// ----      ----     -- 
     36// 6.2       35       ( 35/ 6.2) * 62 = 350  (min FL) 
     37// 18.6      105      (105/18.6) * 62 = 350  (max FL) 
     38#define CF_EFL      350 
     39#define CF_EFL_DIV  62 
    3240 
    3341const int zoom_points = NUM_FL; 
    3442 
    35 int get_effective_focal_length(int zp) 
    36 { 
    37         return (CF_EFL*get_focal_length(zp))/10000; 
     43int get_effective_focal_length(int zp) { 
     44    return (CF_EFL*get_focal_length(zp))/CF_EFL_DIV; 
    3845} 
    3946 
    40 int get_focal_length(int zp) 
    41 { 
    42         if (zp<0) { 
    43                 return fl_tbl[0]; 
    44         } else if (zp>NUM_FL-1) { 
    45                 return fl_tbl[NUM_FL-1]; 
    46         } else { 
    47                 return fl_tbl[zp]; 
    48         } 
     47int get_focal_length(int zp) { 
     48    if (zp < 0) zp = 0; 
     49    else if (zp >= NUM_FL) zp = NUM_FL-1; 
     50    return focus_len_table[zp*NUM_DATA]; 
    4951} 
    5052 
    51 int get_zoom_x(int zp) 
    52 { 
    53         if (zp<1) { 
    54                 return 10; 
    55         } else if (zp>NUM_FL-1) { 
    56                 return fl_tbl[NUM_FL-1]*10/fl_tbl[0]; 
    57         } else { 
    58                 return fl_tbl[zp]*10/fl_tbl[0]; 
    59         } 
     53int get_zoom_x(int zp) { 
     54    return get_focal_length(zp)*10/focus_len_table[0]; 
    6055} 
    6156 
  • branches/reyalp-ptp-live/platform/ixus860_sd870/main.c

    r847 r1814  
    2929} 
    3030 
     31// Focus length table in firmware @0xfffe2990 
     32#define NUM_FL      8   // 0 - 7, entries in firmware 
     33#define NUM_DATA    3   // 3 words each entry, first is FL 
     34extern int focus_len_table[NUM_FL*NUM_DATA]; 
    3135 
    32 static const int fl_tbl[] = {4600, 6140, 7560, 9110, 10830, 12670, 14690, 17300}; 
    33 #define NUM_FL (sizeof(fl_tbl)/sizeof(fl_tbl[0])) 
    34 #define CF_EFL 60869 
     36// Conversion factor lens FL --> 35mm equiv 
     37// lens      35mm     CF 
     38// ----      ----     -- 
     39// 4.6       28       ( 28/ 4.6) * 46 = 280  (min FL) 
     40// 17.3      105      (105/17.3) * 46 = 279.2  (max FL) 
     41#define CF_EFL      280 
     42#define CF_EFL_DIV  46 
    3543 
    3644const int zoom_points = NUM_FL; 
    3745 
    3846int get_effective_focal_length(int zp) { 
    39     return (CF_EFL*get_focal_length(zp))/10000; 
     47    return (CF_EFL*get_focal_length(zp))/CF_EFL_DIV; 
    4048} 
    4149 
    4250int get_focal_length(int zp) { 
    43     if (zp<0) return fl_tbl[0]; 
    44     else if (zp>NUM_FL-1) return fl_tbl[NUM_FL-1]; 
    45     else return fl_tbl[zp]; 
     51    if (zp < 0) zp = 0; 
     52    else if (zp >= NUM_FL) zp = NUM_FL-1; 
     53    return focus_len_table[zp*NUM_DATA]; 
    4654} 
    4755 
    4856int get_zoom_x(int zp) { 
    49     if (zp<1) return 10; 
    50     else if (zp>NUM_FL-1) return fl_tbl[NUM_FL-1]*10/fl_tbl[0]; 
    51     else return fl_tbl[zp]*10/fl_tbl[0]; 
     57    return get_focal_length(zp)*10/focus_len_table[0]; 
    5258} 
    5359 
  • branches/reyalp-ptp-live/platform/ixus95_sd1200/main.c

    r1376 r1814  
    6767#define MODESCNT (sizeof(modemap)/sizeof(modemap[0])) 
    6868 
    69 static const int fl_tbl[] = {6200,7230,8295,9681,11614,14303,18600}; 
    70 #define NUM_FL (sizeof(fl_tbl)/sizeof(fl_tbl[0])) 
    71 #define CF_EFL 56452 
     69// Focus length table in firmware @0xfffe2a8c 
     70#define NUM_FL      7   // 0 - 6, entries in firmware 
     71#define NUM_DATA    3   // 3 words each entry, first is FL 
     72extern int focus_len_table[NUM_FL*NUM_DATA]; 
     73 
     74// Conversion factor lens FL --> 35mm equiv 
     75// lens      35mm     CF 
     76// ----      ----     -- 
     77// 6.2       35       ( 35/ 6.2) * 62 = 350  (min FL) 
     78// 18.6      105      (105/18.6) * 62 = 350  (max FL) 
     79#define CF_EFL      350 
     80#define CF_EFL_DIV  62 
    7281 
    7382const int zoom_points = NUM_FL; 
    7483 
    7584int get_effective_focal_length(int zp) { 
    76     return (CF_EFL*get_focal_length(zp))/10000; 
     85    return (CF_EFL*get_focal_length(zp))/CF_EFL_DIV; 
    7786} 
    7887 
    7988int get_focal_length(int zp) { 
    80     if (zp<0) return fl_tbl[0]; 
    81     else if (zp>NUM_FL-1) return fl_tbl[NUM_FL-1]; 
    82     else return fl_tbl[zp]; 
     89    if (zp < 0) zp = 0; 
     90    else if (zp >= NUM_FL) zp = NUM_FL-1; 
     91    return focus_len_table[zp*NUM_DATA]; 
    8392} 
    8493 
    8594int get_zoom_x(int zp) { 
    86     if (zp<1) return 10; 
    87     else if (zp>NUM_FL-1) return fl_tbl[NUM_FL-1]*10/fl_tbl[0]; 
    88     else return fl_tbl[zp]*10/fl_tbl[0]; 
     95    return get_focal_length(zp)*10/focus_len_table[0]; 
    8996} 
    9097 
  • branches/reyalp-ptp-live/platform/ixus960_sd950/main.c

    r847 r1814  
    2525} 
    2626 
     27// Focus length table in firmware @0xfffe296c 
     28#define NUM_FL      8   // 0 - 7, entries in firmware 
     29#define NUM_DATA    3   // 3 words each entry, first is FL 
     30extern int focus_len_table[NUM_FL*NUM_DATA]; 
    2731 
    28 static const int fl_tbl[] = {7700, 9572, 11454, 13683, 16293, 19548, 23495, 28500}; 
    29 #define NUM_FL (sizeof(fl_tbl)/sizeof(fl_tbl[0])) 
    30 #define CF_EFL 60869 
     32// Conversion factor lens FL --> 35mm equiv 
     33// lens      35mm     CF 
     34// ----      ----     -- 
     35// 7.7       36       ( 36/ 7.7) * 77 = 360  (min FL) 
     36// 28.5      133      (133/28.5) * 77 = 359.3  (max FL) 
     37#define CF_EFL      360 
     38#define CF_EFL_DIV  77 
     39 
    3140const int zoom_points = NUM_FL; 
     41 
    3242int get_effective_focal_length(int zp) { 
    33 return (CF_EFL*get_focal_length(zp))/10000; 
     43    return (CF_EFL*get_focal_length(zp))/CF_EFL_DIV; 
    3444} 
     45 
    3546int get_focal_length(int zp) { 
    36 if (zp<0) return fl_tbl[0]; 
    37 else if (zp>NUM_FL-1) return fl_tbl[NUM_FL-1]; 
    38 else return fl_tbl[zp]; 
     47    if (zp < 0) zp = 0; 
     48    else if (zp >= NUM_FL) zp = NUM_FL-1; 
     49    return focus_len_table[zp*NUM_DATA]; 
    3950} 
     51 
    4052int get_zoom_x(int zp) { 
    41 if (zp<1) return 10; 
    42 else if (zp>NUM_FL-1) return fl_tbl[NUM_FL-1]*10/fl_tbl[0]; 
    43 else return fl_tbl[zp]*10/fl_tbl[0]; 
     53    return get_focal_length(zp)*10/focus_len_table[0]; 
    4454} 
     55 
    4556#if 0 
    4657int rec_switch_state(void) { 
  • branches/reyalp-ptp-live/platform/ixus970_sd890/main.c

    r1377 r1814  
    2626} 
    2727 
     28// Focus length table in firmware @0xfffe297c 
     29#define NUM_FL      12  // 0 - 11, entries in firmware 
     30#define NUM_DATA    3   // 3 words each entry, first is FL 
     31extern int focus_len_table[NUM_FL*NUM_DATA]; 
    2832 
    29 static const int fl_tbl[] = {6600, 7800, 9000, 10300, 11900,13500, 15400, 17700, 20400, 23700, 28000, 33000}; 
    30 #define NUM_FL (sizeof(fl_tbl)/sizeof(fl_tbl[0])) 
    31 #define CF_EFL 56060 
     33// Conversion factor lens FL --> 35mm equiv 
     34// lens      35mm     CF 
     35// ----      ----     -- 
     36// 6.6       37       ( 37/ 6.6) * 66 = 370  (min FL) 
     37// 33.0      185      (185/33.0) * 66 = 370  (max FL) 
     38#define CF_EFL      370 
     39#define CF_EFL_DIV  66 
    3240 
    3341const int zoom_points = NUM_FL; 
    3442 
    35 int get_effective_focal_length(int zp) 
    36 { 
    37         return (CF_EFL*get_focal_length(zp))/10000; 
     43int get_effective_focal_length(int zp) { 
     44    return (CF_EFL*get_focal_length(zp))/CF_EFL_DIV; 
    3845} 
    3946 
    40 int get_focal_length(int zp) 
    41 { 
    42         if (zp<0) { 
    43                 return fl_tbl[0]; 
    44         } else if (zp>NUM_FL-1) { 
    45                 return fl_tbl[NUM_FL-1]; 
    46         } else { 
    47                 return fl_tbl[zp]; 
    48         } 
     47int get_focal_length(int zp) { 
     48    if (zp < 0) zp = 0; 
     49    else if (zp >= NUM_FL) zp = NUM_FL-1; 
     50    return focus_len_table[zp*NUM_DATA]; 
    4951} 
    5052 
    51 int get_zoom_x(int zp) 
    52 { 
    53         if (zp<1) { 
    54                 return 10; 
    55         } else if (zp>NUM_FL-1) { 
    56                 return fl_tbl[NUM_FL-1]*10/fl_tbl[0]; 
    57         } else { 
    58                 return fl_tbl[zp]*10/fl_tbl[0]; 
    59         } 
     53int get_zoom_x(int zp) { 
     54    return get_focal_length(zp)*10/focus_len_table[0]; 
    6055} 
    6156 
  • branches/reyalp-ptp-live/platform/ixus980_sd990/main.c

    r847 r1814  
    2929} 
    3030 
    31 // from sd950, zoom steps and sensor size same 
    32 static const int fl_tbl[] = {7700, 9572, 11454, 13683, 16293, 19548, 23495, 28500}; 
    33 #define NUM_FL (sizeof(fl_tbl)/sizeof(fl_tbl[0])) 
    34 // sd950 uses wrong value 
    35 // #define CF_EFL 60869 
    36 // ewavr 
    37 // SD990 focal length range is 7,7 - 28,5 mm, 36 - 133 in 35-mm equivalent. 
    38 // So, CF_EFL = 36/7.7*10000=46753 or 133/28.5*10000=46666. 
    39 #define CF_EFL 46710 // split the difference 
     31// Focus length table in firmware @0xfffe2a8c 
     32#define NUM_FL      8   // 0 - 7, entries in firmware 
     33#define NUM_DATA    3   // 3 words each entry, first is FL 
     34extern int focus_len_table[NUM_FL*NUM_DATA]; 
     35 
     36// Conversion factor lens FL --> 35mm equiv 
     37// lens      35mm     CF 
     38// ----      ----     -- 
     39// 7.7       36       ( 36/ 7.7) * 77 = 360  (min FL) 
     40// 28.5      133      (133/28.5) * 77 = 359.3  (max FL) //360 on 133.2mm(T) 
     41#define CF_EFL      360 
     42#define CF_EFL_DIV  77 
    4043 
    4144const int zoom_points = NUM_FL; 
    4245 
    4346int get_effective_focal_length(int zp) { 
    44     return (CF_EFL*get_focal_length(zp))/10000; 
     47    return (CF_EFL*get_focal_length(zp))/CF_EFL_DIV; 
    4548} 
    4649 
    4750int get_focal_length(int zp) { 
    48     if (zp<0) return fl_tbl[0]; 
    49     else if (zp>NUM_FL-1) return fl_tbl[NUM_FL-1]; 
    50     else return fl_tbl[zp]; 
     51    if (zp < 0) zp = 0; 
     52    else if (zp >= NUM_FL) zp = NUM_FL-1; 
     53    return focus_len_table[zp*NUM_DATA]; 
    5154} 
    5255 
    5356int get_zoom_x(int zp) { 
    54     if (zp<1) return 10; 
    55     else if (zp>NUM_FL-1) return fl_tbl[NUM_FL-1]*10/fl_tbl[0]; 
    56     else return fl_tbl[zp]*10/fl_tbl[0]; 
     57    return get_focal_length(zp)*10/focus_len_table[0]; 
    5758} 
    5859 
  • branches/reyalp-ptp-live/platform/s95/main.c

    r1059 r1814  
    2626} 
    2727 
     28// Focus length table in firmware @0xfffe2d2c 
     29#define NUM_FL      10  // 0 - 9, entries in firmware 
     30#define NUM_DATA    3   // 3 words each entry, first is FL 
     31extern int focus_len_table[NUM_FL*NUM_DATA]; 
    2832 
    29 //zoom position is get_parameter_data(87) 
    30 static const struct { 
    31         int zp, fl; 
    32 } fl_tbl[] = { 
    33   {   0,   6000}, 
    34   {   1,   6850}, 
    35   {   2,   7490}, 
    36   {   3,   8560}, 
    37   {   4,   9640}, 
    38   {   5,   10700}, 
    39   {   6,   12850}, 
    40   {   7,   14980}, 
    41   {   8,   18190}, 
    42   {   9,   22500}, 
    43 }; 
    44  
    45  
    46 #define NUM_FL (sizeof(fl_tbl)/sizeof(fl_tbl[0])) 
    47 // S90 focal lenght range 6.0 - 22.5 mm (35 mm equivalent: 28 - 105 mm)(1/1.7" Type CCD, Scale Factor To 35 mm Equivalent: 4.6) 
    48 // 28/6,0*10000=46666 
    49 // 105/22,5*10000=46666 
    50  
    51 #define CF_EFL 46666 
     33// Conversion factor lens FL --> 35mm equiv 
     34// lens      35mm     CF 
     35// ----      ----     -- 
     36// 6.0       28       ( 28/ 6.0) * 60 = 280  (min FL) 
     37// 22.5      105      (105/22.5) * 60 = 280  (max FL) 
     38#define CF_EFL      280 
     39#define CF_EFL_DIV  60 
    5240 
    5341const int zoom_points = NUM_FL; 
    5442 
    5543int get_effective_focal_length(int zp) { 
    56     return (CF_EFL*get_focal_length(zp))/10000; 
     44    return (CF_EFL*get_focal_length(zp))/CF_EFL_DIV; 
    5745} 
    5846 
    5947int get_focal_length(int zp) { 
    60         int i; 
    61  
    62         if (zp<fl_tbl[0].zp) 
    63                 return fl_tbl[0].fl; 
    64         else if (zp>fl_tbl[NUM_FL-1].zp) 
    65                 return fl_tbl[NUM_FL-1].fl; 
    66         else { 
    67                 for (i=1; i<NUM_FL; ++i) { 
    68                         if (zp==fl_tbl[i-1].zp) 
    69                                 return fl_tbl[i-1].fl; 
    70                         else if (zp==fl_tbl[i].zp) 
    71                                 return fl_tbl[i].fl; 
    72                         else if (zp<fl_tbl[i].zp) 
    73                                 return fl_tbl[i-1].fl+(zp-fl_tbl[i-1].zp)*(fl_tbl[i].fl-fl_tbl[i-1].fl)/(fl_tbl[i].zp-fl_tbl[i-1].zp); 
    74                 } 
    75         } 
    76         return fl_tbl[NUM_FL-1].fl; 
     48    if (zp < 0) zp = 0; 
     49    else if (zp >= NUM_FL) zp = NUM_FL-1; 
     50    return focus_len_table[zp*NUM_DATA]; 
    7751} 
    7852 
    7953int get_zoom_x(int zp) { 
    80         return get_focal_length(zp)*10/fl_tbl[0].fl; 
     54    return get_focal_length(zp)*10/focus_len_table[0]; 
    8155} 
    82  
    8356 
    8457long get_vbatt_min() 
  • branches/reyalp-ptp-live/platform/s95/sub/100e/stubs_entry.S

    r1641 r1814  
    4141DEF(focus_busy                              ,0x00006f30) // Found @0xff97bec4 
    4242//DEF(recreview_hold                          ,0x00003e14) // Found @0xff8a8648, ** != ** stubs_min = 0x0000828c (0x81f8+0x94) 
     43DEF(palette_control                         ,0x0000a0d4) // Found @0xffa47590 
     44DEF(active_palette_buffer                   ,0x0000a0dc) // Found @0xffa47594 
     45DEF(palette_buffer                          ,0x000bc434) // Found @0xffa47ac8 
     46DEF(bitmap_buffer                           ,0x0000a110) // Found @0xffa4c778 
     47DEF(active_bitmap_buffer                    ,0x0000a108) // Found @0xffa4c77c 
    4348 
    4449// Values below go in 'lib.c': 
  • branches/reyalp-ptp-live/platform/s95/sub/100h/stubs_entry.S

    r1641 r1814  
    4141DEF(focus_busy                              ,0x00006f30) // Found @0xff97bec4 
    4242//DEF(recreview_hold                          ,0x00003e14) // Found @0xff8a8648, ** != ** stubs_min = 0x000082e0 (0x81f8+0xE8) 
     43DEF(palette_control                         ,0x0000a0d4) // Found @0xffa4759c 
     44DEF(active_palette_buffer                   ,0x0000a0dc) // Found @0xffa475a0 
     45DEF(palette_buffer                          ,0x000bc434) // Found @0xffa47ad4 
     46DEF(bitmap_buffer                           ,0x0000a110) // Found @0xffa4c784 
     47DEF(active_bitmap_buffer                    ,0x0000a108) // Found @0xffa4c788 
    4348 
    4449// Values below go in 'lib.c': 
  • branches/reyalp-ptp-live/platform/s95/sub/100i/stubs_entry.S

    r1641 r1814  
    4141DEF(focus_busy                              ,0x00006f30) // Found @0xff97bec4 
    4242//DEF(recreview_hold                          ,0x00003e14) // Found @0xff8a8648, ** != ** stubs_min = 0x000082e0 (0x81f8+0xE8) 
     43DEF(palette_control                         ,0x0000a0d4) // Found @0xffa4759c 
     44DEF(active_palette_buffer                   ,0x0000a0dc) // Found @0xffa475a0 
     45DEF(palette_buffer                          ,0x000bc434) // Found @0xffa47ad4 
     46DEF(bitmap_buffer                           ,0x0000a110) // Found @0xffa4c784 
     47DEF(active_bitmap_buffer                    ,0x0000a108) // Found @0xffa4c788 
    4348 
    4449// Values below go in 'lib.c': 
  • branches/reyalp-ptp-live/platform/s95/sub/100k/stubs_entry.S

    r1641 r1814  
    4141DEF(focus_busy                              ,0x00006f30) // Found @0xff97bec4 
    4242//DEF(recreview_hold                          ,0x00003e14) // Found @0xff8a8648, ** != ** stubs_min = 0x000082e0 (0x81f8+0xE8) 
     43DEF(palette_control                         ,0x0000a0d4) // Found @0xffa4759c 
     44DEF(active_palette_buffer                   ,0x0000a0dc) // Found @0xffa475a0 
     45DEF(palette_buffer                          ,0x000bc434) // Found @0xffa47ad4 
     46DEF(bitmap_buffer                           ,0x0000a110) // Found @0xffa4c784 
     47DEF(active_bitmap_buffer                    ,0x0000a108) // Found @0xffa4c788 
    4348 
    4449// Values below go in 'lib.c': 
  • branches/reyalp-ptp-live/platform/sx100is/main.c

    r847 r1814  
    2929} 
    3030 
     31// Focus length table in firmware @0xfffe31ac 
     32#define NUM_FL      23  // 0 - 22, entries in firmware 
     33#define NUM_DATA    3   // 3 words each entry, first is FL 
     34extern int focus_len_table[NUM_FL*NUM_DATA]; 
    3135 
    32 static const int fl_tbl[] = {6000, 6700, 7300, 8200, 9100, 10300, 11500, 12800, 14400, 16100, 18100, 20100, 22400, 25200, 28100, 31500, 34900, 38900, 42500, 46600, 51100, 55900, 60000}; 
    33 #define NUM_FL (sizeof(fl_tbl)/sizeof(fl_tbl[0])) 
    34 #define CF_EFL 6000 
     36// Conversion factor lens FL --> 35mm equiv 
     37// lens      35mm     CF 
     38// ----      ----     -- 
     39// 6.0       36       ( 36/ 6.0) * 60 = 360  (min FL) 
     40// 60.0      360      (360/60.0) * 60 = 360  (max FL) 
     41#define CF_EFL      360 
     42#define CF_EFL_DIV  60 
    3543 
    3644const int zoom_points = NUM_FL; 
    3745 
    3846int get_effective_focal_length(int zp) { 
    39     return (CF_EFL*get_focal_length(zp))/1000; 
     47    return (CF_EFL*get_focal_length(zp))/CF_EFL_DIV; 
    4048} 
    4149 
    4250int get_focal_length(int zp) { 
    43     if (zp<0) return fl_tbl[0]; 
    44     else if (zp>NUM_FL-1) return fl_tbl[NUM_FL-1]; 
    45     else return fl_tbl[zp]; 
     51    if (zp < 0) zp = 0; 
     52    else if (zp >= NUM_FL) zp = NUM_FL-1; 
     53    return focus_len_table[zp*NUM_DATA]; 
    4654} 
    4755 
    4856int get_zoom_x(int zp) { 
    49     if (zp<1) return 10; 
    50     else if (zp>NUM_FL-1) return fl_tbl[NUM_FL-1]*10/fl_tbl[0]; 
    51     else return fl_tbl[zp]*10/fl_tbl[0]; 
     57    return get_focal_length(zp)*10/focus_len_table[0]; 
    5258} 
    5359 
  • branches/reyalp-ptp-live/platform/sx110is/main.c

    r847 r1814  
    2929} 
    3030 
     31// Focus length table in firmware @0xfffe31bc 
     32#define NUM_FL      23  // 0 - 22, entries in firmware 
     33#define NUM_DATA    3   // 3 words each entry, first is FL 
     34extern int focus_len_table[NUM_FL*NUM_DATA]; 
    3135 
    32 //fl_tbl still the same as sx100 
    33 static const int fl_tbl[] = {6000, 6700, 7300, 8200, 9100, 10300, 11500, 12800, 14400, 16100, 18100, 20100, 22400, 25200, 28100, 31500, 34900, 38900, 42500, 46600, 51100, 55900, 60000}; 
    34 #define NUM_FL (sizeof(fl_tbl)/sizeof(fl_tbl[0])) 
    35 //#define CF_EFL 6000 
    36 #define CF_EFL 5600             //      1/2.3" as sx10 
     36// Conversion factor lens FL --> 35mm equiv 
     37// lens      35mm     CF 
     38// ----      ----     -- 
     39// 6.0       36       ( 36/ 6.0) * 60 = 360  (min FL) 
     40// 60.0      360      (360/60.0) * 60 = 360  (max FL) 
     41#define CF_EFL      360 
     42#define CF_EFL_DIV  60 
    3743 
    3844const int zoom_points = NUM_FL; 
    3945 
    4046int get_effective_focal_length(int zp) { 
    41         return (CF_EFL*get_focal_length(zp))/1000; 
     47    return (CF_EFL*get_focal_length(zp))/CF_EFL_DIV; 
    4248} 
    4349 
    4450int get_focal_length(int zp) { 
    45     if (zp<0) return fl_tbl[0]; 
    46     else if (zp>NUM_FL-1) return fl_tbl[NUM_FL-1]; 
    47     else return fl_tbl[zp]; 
     51    if (zp < 0) zp = 0; 
     52    else if (zp >= NUM_FL) zp = NUM_FL-1; 
     53    return focus_len_table[zp*NUM_DATA]; 
    4854} 
    4955 
    5056int get_zoom_x(int zp) { 
    51     if (zp<1) return 10; 
    52     else if (zp>NUM_FL-1) return fl_tbl[NUM_FL-1]*10/fl_tbl[0]; 
    53     else return fl_tbl[zp]*10/fl_tbl[0]; 
     57    return get_focal_length(zp)*10/focus_len_table[0]; 
    5458} 
    5559 
  • branches/reyalp-ptp-live/platform/sx120is/main.c

    r1527 r1814  
    2929} 
    3030 
    31 // from sx100 
    32 //fl_tbl still the same as sx100 
    33 static const int fl_tbl[] = {6000, 6700, 7300, 8200, 9100, 10300, 11500, 12800, 14400, 16100, 18100, 20100, 22400, 25200, 28100, 31500, 34900, 38900, 42500, 46600, 51100, 55900, 60000}; 
    34 #define NUM_FL (sizeof(fl_tbl)/sizeof(fl_tbl[0])) 
    35 //#define CF_EFL 6000 
    36 #define CF_EFL 5600             //      1/2.3" as sx10 
     31// Focus length table in firmware @0xfffe328c 
     32#define NUM_FL      23  // 0 - 22, entries in firmware 
     33#define NUM_DATA    3   // 3 words each entry, first is FL 
     34extern int focus_len_table[NUM_FL*NUM_DATA]; 
     35 
     36// Conversion factor lens FL --> 35mm equiv 
     37// lens      35mm     CF 
     38// ----      ----     -- 
     39// 6.0       36       ( 36/ 6.0) * 60 = 360  (min FL) 
     40// 60.0      360      (360/60.0) * 60 = 360  (max FL) 
     41#define CF_EFL      360 
     42#define CF_EFL_DIV  60 
    3743 
    3844const int zoom_points = NUM_FL; 
    3945 
    4046int get_effective_focal_length(int zp) { 
    41         return (CF_EFL*get_focal_length(zp))/1000; 
     47    return (CF_EFL*get_focal_length(zp))/CF_EFL_DIV; 
    4248} 
    4349 
    4450int get_focal_length(int zp) { 
    45     if (zp<0) return fl_tbl[0]; 
    46     else if (zp>NUM_FL-1) return fl_tbl[NUM_FL-1]; 
    47     else return fl_tbl[zp]; 
     51    if (zp < 0) zp = 0; 
     52    else if (zp >= NUM_FL) zp = NUM_FL-1; 
     53    return focus_len_table[zp*NUM_DATA]; 
    4854} 
    4955 
    5056int get_zoom_x(int zp) { 
    51     if (zp<1) return 10; 
    52     else if (zp>NUM_FL-1) return fl_tbl[NUM_FL-1]*10/fl_tbl[0]; 
    53     else return fl_tbl[zp]*10/fl_tbl[0]; 
     57    return get_focal_length(zp)*10/focus_len_table[0]; 
    5458} 
    55  
    56 //end sx100 
    57  
    58  
    5959 
    6060long get_vbatt_min() 
  • branches/reyalp-ptp-live/platform/sx130is/main.c

    r1161 r1814  
    2626} 
    2727 
     28// Focus length table in firmware @0xfffe94ec 
     29#define NUM_FL      128 // 0 - 127, entries in firmware 
     30#define NUM_DATA    3   // 3 words each entry, first is FL 
     31extern int focus_len_table[NUM_FL*NUM_DATA]; 
    2832 
    29 //zoom position is get_parameter_data(87) 
    30 static const struct { 
    31         int zp, fl; 
    32 } fl_tbl[] = { 
    33   {   0,    5000}, 
    34   {   16,   8225}, 
    35   {   32,   13080}, 
    36   {   48,   20270}, 
    37   {   64,   29150}, 
    38   {   80,   38125}, 
    39   {   96,   45750}, 
    40   {   112,  51650}, 
    41   {   127,  60000} 
    42 }; 
     33// Conversion factor lens FL --> 35mm equiv 
     34// lens      35mm     CF 
     35// ----      ----     -- 
     36// 5.0       28       ( 28/ 5.0) * 50 = 280  (min FL) 
     37// 60.0      336      (336/60.0) * 50 = 280  (max FL) 
     38#define CF_EFL      280 
     39#define CF_EFL_DIV  50 
    4340 
    44  
    45 #define NUM_FL (sizeof(fl_tbl)/sizeof(fl_tbl[0])) 
    46  
    47 // SX130 focal lenght range 5.0 - 60 mm (35 mm equivalent: 28 - 336 mm)(1/2.3" Type CCD, Scale Factor To 35 mm Equivalent: 5.6) 
    48 // 28/5.0*100=560 
    49 // 336/60*100=560 
    50 #define CF_EFL 560 
    51  
    52 const int zoom_points = 128; 
     41const int zoom_points = NUM_FL; 
    5342 
    5443int get_effective_focal_length(int zp) { 
    55     return (CF_EFL*get_focal_length(zp))/100; 
     44    return (CF_EFL*get_focal_length(zp))/CF_EFL_DIV; 
    5645} 
    5746 
    5847int get_focal_length(int zp) { 
    59         int i; 
    60  
    61         if (zp<fl_tbl[0].zp) 
    62                 return fl_tbl[0].fl; 
    63         else if (zp>fl_tbl[NUM_FL-1].zp) 
    64                 return fl_tbl[NUM_FL-1].fl; 
    65         else { 
    66                 for (i=1; i<NUM_FL; ++i) { 
    67                         if (zp==fl_tbl[i-1].zp) 
    68                                 return fl_tbl[i-1].fl; 
    69                         else if (zp==fl_tbl[i].zp) 
    70                                 return fl_tbl[i].fl; 
    71                         else if (zp<fl_tbl[i].zp) 
    72                                 return fl_tbl[i-1].fl+(zp-fl_tbl[i-1].zp)*(fl_tbl[i].fl-fl_tbl[i-1].fl)/(fl_tbl[i].zp-fl_tbl[i-1].zp); 
    73                 } 
    74         } 
    75         return fl_tbl[NUM_FL-1].fl; 
     48    if (zp < 0) zp = 0; 
     49    else if (zp >= NUM_FL) zp = NUM_FL-1; 
     50    return focus_len_table[zp*NUM_DATA]; 
    7651} 
    7752 
    7853int get_zoom_x(int zp) { 
    79         return get_focal_length(zp)*10/fl_tbl[0].fl; 
     54    return get_focal_length(zp)*10/focus_len_table[0]; 
    8055} 
    81  
    8256 
    8357long get_vbatt_min() 
  • branches/reyalp-ptp-live/platform/sx130is/sub/101c/stubs_entry.S

    r1641 r1814  
    4545DEF(focus_busy                              ,0x00006978) // Found @0xff95fd2c 
    4646//DEF(recreview_hold                          ,0x00003a50) // Found @0xff89d940, ** != ** stubs_min = 0x000079d0 (0x78E4+0xEC) 
     47DEF(palette_control                         ,0x00009458) // Found @0xffa093d0 
     48DEF(active_palette_buffer                   ,0x00009460) // Found @0xffa093d4 
     49DEF(palette_buffer                          ,0x000b3a58) // Found @0xffa0978c 
    4750 
    4851// Values below go in 'lib.c': 
  • branches/reyalp-ptp-live/platform/sx130is/sub/101d/stubs_entry.S

    r1641 r1814  
    4545DEF(focus_busy                              ,0x00006978) // Found @0xff95fd2c 
    4646//DEF(recreview_hold                          ,0x00003a50) // Found @0xff89d940, ** != ** stubs_min = 0x000079d0 (0x78E4+0xEC) 
     47DEF(palette_control                         ,0x00009458) // Found @0xffa093d0 
     48DEF(active_palette_buffer                   ,0x00009460) // Found @0xffa093d4 
     49DEF(palette_buffer                          ,0x000b3a58) // Found @0xffa0978c 
    4750 
    4851// Values below go in 'lib.c': 
  • branches/reyalp-ptp-live/platform/sx130is/sub/101f/stubs_entry.S

    r1641 r1814  
    4242DEF(focus_busy                              ,0x00006978) // Found @0xff95fd2c 
    4343//DEF(recreview_hold                          ,0x00003a50) // Found @0xff89d940, ** != ** stubs_min = 0x000079d0 (0x78E4+0xEC) 
     44DEF(palette_control                         ,0x00009458) // Found @0xffa093d0 
     45DEF(active_palette_buffer                   ,0x00009460) // Found @0xffa093d4 
     46DEF(palette_buffer                          ,0x000b3a58) // Found @0xffa0978c 
    4447 
    4548// Values below go in 'lib.c': 
  • branches/reyalp-ptp-live/platform/sx150is/kbd.c

    r1607 r1814  
    1818static KeyMap keymap[]; 
    1919static long last_kbd_key = 0; 
    20 static long alt_mode_key_mask = 0x00005000; 
    21 static long alt_mode_key_reg  = 2; 
    2220 
    2321volatile int jogdial_stopped=0; 
     
    2624#define KEYS_MASK0 (0x00000000) 
    2725#define KEYS_MASK1 (0x0000F000) 
    28 #define KEYS_MASK2 (0x00007F00) 
     26#define KEYS_MASK2 (0x00007F50) 
    2927 
    3028#define SD_READONLY_FLAG    (0x20000) // Found @0xffb90df0, levent 0x20a 
     
    5149        // always pressed if KEY_SHOOT_FULL is. --MarcusSt 
    5250    { 2, KEY_VIDEO     , 0x00000010 }, 
    53     { 2, KEY_PLAYBACK  , 0x00000040 }, 
     51    { 2, KEY_PRINT     , 0x00000040 }, // playback 
     52    { 2, KEY_PLAYBACK  , 0x00000040 }, // alias so script can use it TODO not clear if wee need PRINT version 
    5453        { 2, KEY_UP        , 0x00000100 }, 
    5554        { 2, KEY_DOWN      , 0x00000200 }, 
     
    5857        { 2, KEY_SET       , 0x00001000 }, 
    5958        { 2, KEY_MENU      , 0x00002000 }, 
    60         { 2, KEY_PRINT     , 0x00005000 }, // SET+DISP 
    6159        { 2, KEY_DISPLAY   , 0x00004000 }, 
    6260        { 2, KEY_ERASE     , 0x00008000 }, 
     
    134132                physw_status[1] = kbd_new_state[1]; 
    135133                physw_status[2] = kbd_new_state[2]; 
    136                 //physw_status[0] |= alt_mode_key_mask; 
    137134                jogdial_stopped=0; 
    138135        } 
     
    162159} 
    163160 
     161// NOP 
    164162void kbd_set_alt_mode_key_mask(long key) 
    165163{ 
    166     int i; 
    167     for (i=0; keymap[i].hackkey; ++i) { 
    168         if (keymap[i].hackkey == key) { 
    169             alt_mode_key_mask = keymap[i].canonkey; 
    170             alt_mode_key_reg  = keymap[i].grp; 
    171             return; 
    172         } 
    173     } 
    174164} 
    175165 
  • branches/reyalp-ptp-live/platform/sx150is/main.c

    r1415 r1814  
    2626} 
    2727 
     28// Focus length table in firmware @0xfffeabd8 
     29#define NUM_FL      128 // 0 - 127, entries in firmware 
     30#define NUM_DATA    2   // 2 words each entry, first is FL 
     31extern int focus_len_table[NUM_FL*NUM_DATA]; 
    2832 
    29 //zoom position is get_parameter_data(87) 
    30 static const struct { 
    31         int zp, fl; 
    32 } fl_tbl[] = { 
    33   {   0,    5000}, 
    34   {   16,   8225}, 
    35   {   32,   13080}, 
    36   {   48,   20270}, 
    37   {   64,   29150}, 
    38   {   80,   38125}, 
    39   {   96,   45750}, 
    40   {   112,  51650}, 
    41   {   127,  60000} 
    42 }; 
     33// Conversion factor lens FL --> 35mm equiv 
     34// lens      35mm     CF 
     35// ----      ----     -- 
     36// 5.0       28       ( 28/ 5.0) * 50 = 280  (min FL) 
     37// 60.0      336      (336/60.0) * 50 = 280  (max FL) 
     38#define CF_EFL      280 
     39#define CF_EFL_DIV  50 
    4340 
    44  
    45 #define NUM_FL (sizeof(fl_tbl)/sizeof(fl_tbl[0])) 
    46  
    47 // SX150 focal lenght range 5.0 - 60 mm (35 mm equivalent: 28 - 336 mm)(1/2.3" Type CCD, Scale Factor To 35 mm Equivalent: 5.6) 
    48 // 28/5.0*100=560 
    49 // 336/60*100=560 
    50 #define CF_EFL 560 
    51  
    52 const int zoom_points = 128; 
     41const int zoom_points = NUM_FL; 
    5342 
    5443int get_effective_focal_length(int zp) { 
    55     return (CF_EFL*get_focal_length(zp))/100; 
     44    return (CF_EFL*get_focal_length(zp))/CF_EFL_DIV; 
    5645} 
    5746 
    5847int get_focal_length(int zp) { 
    59         int i; 
    60  
    61         if (zp<fl_tbl[0].zp) 
    62                 return fl_tbl[0].fl; 
    63         else if (zp>fl_tbl[NUM_FL-1].zp) 
    64                 return fl_tbl[NUM_FL-1].fl; 
    65         else { 
    66                 for (i=1; i<NUM_FL; ++i) { 
    67                         if (zp==fl_tbl[i-1].zp) 
    68                                 return fl_tbl[i-1].fl; 
    69                         else if (zp==fl_tbl[i].zp) 
    70                                 return fl_tbl[i].fl; 
    71                         else if (zp<fl_tbl[i].zp) 
    72                                 return fl_tbl[i-1].fl+(zp-fl_tbl[i-1].zp)*(fl_tbl[i].fl-fl_tbl[i-1].fl)/(fl_tbl[i].zp-fl_tbl[i-1].zp); 
    73                 } 
    74         } 
    75         return fl_tbl[NUM_FL-1].fl; 
     48    if (zp < 0) zp = 0; 
     49    else if (zp >= NUM_FL) zp = NUM_FL-1; 
     50    return focus_len_table[zp*NUM_DATA]; 
    7651} 
    7752 
    7853int get_zoom_x(int zp) { 
    79         return get_focal_length(zp)*10/fl_tbl[0].fl; 
     54    return get_focal_length(zp)*10/focus_len_table[0]; 
    8055} 
    81  
    8256 
    8357long get_vbatt_min() 
  • branches/reyalp-ptp-live/platform/sx150is/notes.txt

    r1761 r1814  
    33* DryOS R39 Camera 
    44--- 
    5 Alt shortcut: disp+set 
    6 Note, you can hold either one and click the other 
     5Alt shortcut: 
     6adjustable, default is the play button. Hold for 1/2 second for original function 
    77 
    88This camera is able to boot from FAT32 cards when the appropriate BOOTDISK string is written 
  • branches/reyalp-ptp-live/platform/sx150is/platform_camera.h

    r1711 r1814  
    3636    #undef  CAM_UNCACHED_BIT 
    3737    #define CAM_UNCACHED_BIT                            0x40000000 
     38 
     39    #define CAM_ADJUSTABLE_ALT_BUTTON           1 
    3840 
    3941    #define CAM_DNG_LENS_INFO                           { 50,10, 600,10, 34,10, 56,10 } // See comments in camera.h 
  • branches/reyalp-ptp-live/platform/sx150is/sub/100a/stubs_entry.S

    r1658 r1814  
    4040DEF(focus_busy                              ,0x00006c5c) // Found @0xff97b73c 
    4141DEF(recreview_hold                          ,0x00003b7c) // Found @0xff8a6484 
     42DEF(palette_control                         ,0x00009654) // Found @0xffa29f88 
     43//DEF(active_palette_buffer                   ,0x0000965c) // Found @0xffa29f8c, ** != ** stubs_min = 0x00009654 (0x9654) 
     44//DEF(palette_buffer                          ,0x000baa84) // Found @0xffa2a340,          stubs_min = 0x000baa84 (0xBAA84) 
    4245 
    4346// Values below go in 'lib.c': 
  • branches/reyalp-ptp-live/platform/sx220hs/kbd.c

    r1568 r1814  
    1717static KeyMap keymap[]; 
    1818static long last_kbd_key = 0; 
    19  
    20 static long alt_mode_key_mask = 0x00010800; // disp + set 
    2119static int alt_mode_led=0; 
    2220extern void _GetKbdState(long*); 
     
    5048static KeyMap keymap[] = { 
    5149 
    52         /* tiny bug: key order matters. see kbd_get_pressed_key() 
    53          * for example*/ 
    54   
    55  
    56         { 0, KEY_ZOOM_OUT        , 0x00000001 }, 
    57         { 0, KEY_ZOOM_OUT1       , 0x00000001 }, 
    58         { 0, KEY_ZOOM_OUT        , 0x00000002 },         
    59         { 0, KEY_ZOOM_OUT3       , 0x00000002 },         
    60         { 0, KEY_ZOOM_OUT                , 0x00000003 }, 
    61         { 0, KEY_ZOOM_OUT2               , 0x00000003 }, 
    62         { 0, KEY_ZOOM_IN         , 0x00000004 }, 
    63         { 0, KEY_ZOOM_IN1        , 0x00000004 },         
    64         { 0, KEY_ZOOM_IN                 , 0x00000008 }, 
    65         { 0, KEY_ZOOM_IN3                , 0x00000008 }, 
    66         { 0, KEY_ZOOM_IN                 , 0x0000000C }, 
    67         { 0, KEY_ZOOM_IN2                , 0x0000000C }, 
    68         { 0, KEY_DISPLAY         , 0x00000800 }, 
    69         { 0, KEY_UP                      , 0x00001000 },  
    70         { 0, KEY_RIGHT               , 0x00006000 }, 
    71         { 0, KEY_SET                 , 0x00010000 }, 
    72         { 0, KEY_PRINT               , 0x00010800 },  //DISP+SET for ALT menu 
    73         { 0, KEY_DOWN                , 0x00020000 }, 
    74         { 0, KEY_MENU                , 0x00040000 }, 
    75         { 0, KEY_VIDEO               , 0x00080000 },     
    76         { 0, KEY_RIGHT_SOFT          , 0x00002000 }, 
    77         { 0, KEY_UP_SOFT             , 0x00000400 }, 
    78         { 0, KEY_DOWN_SOFT           , 0x00008000 },     
    79          
    80         { 2, KEY_LEFT_SOFT               , 0x00000080 }, 
    81         { 2, KEY_LEFT                    , 0x00000100 }, 
    82         { 2, KEY_SHOOT_FULL              , 0x00002002 },         
    83         { 2, KEY_SHOOT_FULL_ONLY , 0x00000002 },         
    84         { 2, KEY_SHOOT_HALF              , 0x00002000 }, 
    85  
    86         { 1, KEY_PLAYBACK            , 0x00200000 },     
    87  
    88         { 0, 0, 0 } 
     50    /* tiny bug: key order matters. see kbd_get_pressed_key() 
     51    * for example*/ 
     52 
     53    { 0, KEY_ZOOM_OUT        , 0x00000001 }, 
     54    { 0, KEY_ZOOM_OUT1       , 0x00000001 }, 
     55    { 0, KEY_ZOOM_OUT        , 0x00000002 }, 
     56    { 0, KEY_ZOOM_OUT3       , 0x00000002 }, 
     57    { 0, KEY_ZOOM_OUT        , 0x00000003 }, 
     58    { 0, KEY_ZOOM_OUT2       , 0x00000003 }, 
     59    { 0, KEY_ZOOM_IN         , 0x00000004 }, 
     60    { 0, KEY_ZOOM_IN1        , 0x00000004 }, 
     61    { 0, KEY_ZOOM_IN         , 0x00000008 }, 
     62    { 0, KEY_ZOOM_IN3        , 0x00000008 }, 
     63    { 0, KEY_ZOOM_IN         , 0x0000000C }, 
     64    { 0, KEY_ZOOM_IN2        , 0x0000000C }, 
     65    { 0, KEY_DISPLAY         , 0x00000800 }, 
     66    { 0, KEY_UP              , 0x00001000 },  
     67    { 0, KEY_RIGHT           , 0x00006000 }, 
     68    { 0, KEY_SET             , 0x00010000 }, 
     69    { 0, KEY_DOWN            , 0x00020000 }, 
     70    { 0, KEY_MENU            , 0x00040000 }, 
     71    { 0, KEY_VIDEO           , 0x00080000 }, 
     72 //   { 0, KEY_RIGHT_SOFT      , 0x00002000 },  //soft keys commented out but still counted in the keymasks, seems to disable them like we want. 
     73 //   { 0, KEY_UP_SOFT         , 0x00000400 },  //if enabled can cause unintentional button presses in alt menu when rotating the jogdial really fast. 
     74 //   { 0, KEY_DOWN_SOFT       , 0x00008000 }, 
     75 
     76    { 1, KEY_PRINT           , 0x00200000 }, // playback = alt button 
     77    { 1, KEY_PLAYBACK        , 0x00200000 }, 
     78 
     79 //   { 2, KEY_LEFT_SOFT       , 0x00000080 }, 
     80    { 2, KEY_LEFT            , 0x00000100 }, 
     81    { 2, KEY_SHOOT_FULL      , 0x00002002 }, 
     82    { 2, KEY_SHOOT_FULL_ONLY , 0x00000002 }, 
     83    { 2, KEY_SHOOT_HALF      , 0x00002000 }, 
     84 
     85    { 0, 0, 0 } 
    8986}; 
    9087 
     88// NOP 
    9189void kbd_set_alt_mode_key_mask(long key) 
    9290{ 
    93         int i; 
    94         for (i=0; keymap[i].hackkey; ++i) { 
    95                 if (keymap[i].hackkey == key) { 
    96                         alt_mode_key_mask = keymap[i].canonkey; 
    97                         return; 
    98                 } 
    99         } 
    10091} 
    10192 
  • branches/reyalp-ptp-live/platform/sx220hs/main.c

    r1230 r1814  
    2929} 
    3030 
    31 // Focus length table in firmware @FFF4A3DC  //sx220. like in g12 and sx30 
    32 #define NUM_FL 126              // 0 - 125, entries in firmware (3 words each entry, first is FL) 
    33 extern int focus_len_table[NUM_FL*3]; 
     31// Focus length table in firmware @FFF4A3DC 
     32#define NUM_FL      126 // 0 - 125, entries in firmware 
     33#define NUM_DATA    3   // 3 words each entry, first is FL 
     34extern int focus_len_table[NUM_FL*NUM_DATA]; 
    3435 
     36// Conversion factor lens FL --> 35mm equiv 
     37// lens      35mm     CF 
     38// ----      ----     -- 
     39// 5.0       28       ( 28/ 5.0) * 50 = 280  (min FL) 
     40// 70.0      392      (392/70.0) * 50 = 280  (max FL) 
     41#define CF_EFL      280 
     42#define CF_EFL_DIV  50 
    3543 
    36 // Focal length range is 5.0 - 70,0 mm, 28 - 392 in 35-mm equivalent. 
    37 // So, CF_EFL = 28/5.0*10000=56000 or392/70*10000=56000 
    38 // divide by 10 to avoid overflow in get_effective_focal_length() 
    39 #define CF_EFL  5600 
    40 const int zoom_points = 126; 
     44const int zoom_points = NUM_FL; 
    4145 
    4246int get_effective_focal_length(int zp) { 
    43         return (CF_EFL*get_focal_length(zp))/1000; 
     47    return (CF_EFL*get_focal_length(zp))/CF_EFL_DIV; 
    4448} 
    4549 
    4650int get_focal_length(int zp) { 
    47         if (zp < 0) zp = 0; 
    48         else if (zp >= NUM_FL) zp = NUM_FL-1; 
    49         return focus_len_table[zp*3]; 
    50          
     51    if (zp < 0) zp = 0; 
     52    else if (zp >= NUM_FL) zp = NUM_FL-1; 
     53    return focus_len_table[zp*NUM_DATA]; 
    5154} 
    5255 
    5356int get_zoom_x(int zp) { 
    54         return get_focal_length(zp)*10/focus_len_table[0]; 
     57    return get_focal_length(zp)*10/focus_len_table[0]; 
    5558} 
    56  
    5759 
    5860long get_vbatt_min() 
  • branches/reyalp-ptp-live/platform/sx220hs/notes.txt

    r1230 r1814  
    22SX220 HS Notes 
    33 
    4 To enter CHDK <Alt> mode use the DISP+SET button. 
     4To enter CHDK <Alt> mode use the playback button. 
    55 
    66Support for dual partition is not available. 
  • branches/reyalp-ptp-live/platform/sx220hs/platform_camera.h

    r1711 r1814  
    110110        #define REMOTE_SYNC_STATUS_LED  0xC0220130              // specifies an LED that turns on while camera waits for USB remote to sync 
    111111         
     112        #define DRAW_ON_ACTIVE_BITMAP_BUFFER_ONLY       1 
    112113//---------------------------------------------------------- 
  • branches/reyalp-ptp-live/platform/sx220hs/sub/100a/stubs_entry.S

    r1658 r1814  
    4949DEF(focus_busy                              ,0x00008338) // Found @0xff17c768 
    5050//DEF(recreview_hold                          ,0x00004d80) // Found @0xff09e130, ** != ** stubs_min = 0x000094c4 (0x93D4+0xF0) 
     51DEF(palette_control                         ,0x0000b35c) // Found @0xff23d5a4 
     52DEF(active_palette_buffer                   ,0x0000b364) // Found @0xff23d5a8 
     53DEF(palette_buffer                          ,0x000cae40) // Found @0xff23da80 
     54DEF(bitmap_buffer                           ,0x0000b39c) // Found @0xff242700 
     55DEF(active_bitmap_buffer                    ,0x0000b394) // Found @0xff242704 
    5156 
    5257// Values below go in 'lib.c': 
  • branches/reyalp-ptp-live/platform/sx220hs/sub/100a/stubs_min.S

    r1755 r1814  
    66DEF(palette_buffer,                     0xCAE40) // loc_FF23DA3C (1.01a) 
    77DEF(recreview_hold,                     0x93D4 + 0xF0)  // FF1B6640 
    8 DEF(enabled_refresh_physical_screen,    0x53C4 + 0x14)  //changed to fix error when displaying menu, was 0x20 FF0A99C0  
    98DEF(led_table,                          0x258C + 0x04)  // FF0557C4 
  • branches/reyalp-ptp-live/platform/sx220hs/sub/101a/stubs_entry.S

    r1658 r1814  
    4949DEF(focus_busy                              ,0x00008338) // Found @0xff17c768 
    5050//DEF(recreview_hold                          ,0x00004d80) // Found @0xff09e130, ** != ** stubs_min = 0x000094c4 (0x93D4+0xF0) 
     51DEF(palette_control                         ,0x0000b35c) // Found @0xff23d5a4 
     52DEF(active_palette_buffer                   ,0x0000b364) // Found @0xff23d5a8 
     53DEF(palette_buffer                          ,0x000cae40) // Found @0xff23da80 
     54DEF(bitmap_buffer                           ,0x0000b39c) // Found @0xff242700 
     55DEF(active_bitmap_buffer                    ,0x0000b394) // Found @0xff242704 
    5156 
    5257// Values below go in 'lib.c': 
  • branches/reyalp-ptp-live/platform/sx220hs/sub/101a/stubs_min.S

    r1755 r1814  
    77DEF(zoom_status,                        0xF5A4)         // ff31c404 
    88DEF(recreview_hold,                     0x93D4 + 0xF0)  // FF1B6640 
    9 DEF(enabled_refresh_physical_screen,    0x53C4 + 0x14)  //changed to fix error when displaying menu, was 0x20 FF0A99C0  
    109DEF(led_table,                          0x258C + 0x04)  // FF0557C4 
  • branches/reyalp-ptp-live/platform/sx220hs/sub/101b/stubs_entry.S

    r1658 r1814  
    4949DEF(focus_busy                              ,0x00008338) // Found @0xff17c768 
    5050//DEF(recreview_hold                          ,0x00004d80) // Found @0xff09e130, ** != ** stubs_min = 0x000094c4 (0x93D4+0xF0) 
     51DEF(palette_control                         ,0x0000b35c) // Found @0xff23d5a4 
     52DEF(active_palette_buffer                   ,0x0000b364) // Found @0xff23d5a8 
     53DEF(palette_buffer                          ,0x000cae40) // Found @0xff23da80 
     54DEF(bitmap_buffer                           ,0x0000b39c) // Found @0xff242700 
     55DEF(active_bitmap_buffer                    ,0x0000b394) // Found @0xff242704 
    5156 
    5257// Values below go in 'lib.c': 
  • branches/reyalp-ptp-live/platform/sx220hs/sub/101b/stubs_min.S

    r1755 r1814  
    88DEF(zoom_status,                        0xF5A4)         // ff31c404 
    99DEF(recreview_hold,                     0x93D4 + 0xF0)  // FF1B6640 
    10 DEF(enabled_refresh_physical_screen,    0x53C4 + 0x14)  //changed to fix error when displaying menu, was 0x20 FF0A99C0  
    1110DEF(led_table,                          0x258C + 0x04)  // FF0557C4 
  • branches/reyalp-ptp-live/platform/sx230hs/kbd.c

    r1720 r1814  
    2020static KeyMap keymap[]; 
    2121static long last_kbd_key = 0; 
    22 ; 
    23 static long alt_mode_key_mask = 0x00010800; // disp + set 
    2422static int alt_mode_led=0; 
    2523extern void _GetKbdState(long*); 
     
    7977    { 0, KEY_DOWN_SOFT       , 0x00008000 }, 
    8078    { 0, KEY_SET             , 0x00010000 }, 
    81     { 0, KEY_PRINT           , 0x00010800 },  //DISP+SET for ALT menu 
    8279    { 0, KEY_DOWN            , 0x00020000 }, 
    8380    { 0, KEY_MENU            , 0x00040000 }, 
    8481    { 0, KEY_VIDEO           , 0x00080000 }, 
     82 
     83    { 1, KEY_PRINT           , 0x00200000 }, // playback = alt button 
    8584    { 1, KEY_PLAYBACK        , 0x00200000 }, 
     85 
    8686    { 2, KEY_LEFT_SOFT       , 0x00000080 }, 
    8787    { 2, KEY_LEFT            , 0x00000100 }, 
     
    8989    { 2, KEY_SHOOT_FULL_ONLY , 0x00000002 }, 
    9090    { 2, KEY_SHOOT_HALF      , 0x00002000 }, 
     91 
    9192    { 0, 0, 0 } 
    9293}; 
    9394 
     95// NOP 
    9496void kbd_set_alt_mode_key_mask(long key) 
    9597{ 
    96         int i; 
    97         for (i=0; keymap[i].hackkey; ++i) { 
    98                 if (keymap[i].hackkey == key) { 
    99                         alt_mode_key_mask = keymap[i].canonkey; 
    100                         return; 
    101                 } 
    102         } 
    103 } 
     98} 
     99 
    104100void my_blinkk(void) { 
    105101        int i; 
  • branches/reyalp-ptp-live/platform/sx230hs/main.c

    r1331 r1814  
    2828} 
    2929 
    30 // Focus length table in firmware @FFF4A3DC  
    31 #define NUM_FL 126              // 0 - 125, entries in firmware (3 words each entry, first is FL) 
    32 extern int focus_len_table[NUM_FL*3]; 
     30// Focus length table in firmware @FFF4A3DC 
     31#define NUM_FL      126 // 0 - 125, entries in firmware 
     32#define NUM_DATA    3   // 3 words each entry, first is FL 
     33extern int focus_len_table[NUM_FL*NUM_DATA]; 
    3334 
    34 // Focal length range is 5.0 - 70,0 mm, 28 - 392 in 35-mm equivalent. 
    35 // So, CF_EFL = 28/5.0*10000=56000 or392/70*10000=56000 
    36 // divide by 10 to avoid overflow in get_effective_focal_length() 
    37 #define CF_EFL  5600 
    38 const int zoom_points = 126; 
     35// Conversion factor lens FL --> 35mm equiv 
     36// lens      35mm     CF 
     37// ----      ----     -- 
     38// 5.0       28       ( 28/ 5.0) * 50 = 280  (min FL) 
     39// 70.0      392      (392/70.0) * 50 = 280  (max FL) 
     40#define CF_EFL      280 
     41#define CF_EFL_DIV  50 
    3942 
    40 //TODO 
     43const int zoom_points = NUM_FL; 
     44 
    4145int get_effective_focal_length(int zp) { 
    42         return (CF_EFL*get_focal_length(zp))/1000; 
     46    return (CF_EFL*get_focal_length(zp))/CF_EFL_DIV; 
    4347} 
    4448 
    45 //TODO 
    4649int get_focal_length(int zp) { 
    47          
    48         if (zp < 0) zp = 0; 
    49         else if (zp >= NUM_FL) zp = NUM_FL-1; 
    50         return focus_len_table[zp*3]; 
    51 /*       
    52         int i; 
    53  
    54         if (zp<fl_tbl[0].zp) 
    55                 return fl_tbl[0].fl; 
    56         else if (zp>fl_tbl[NUM_FL-1].zp) 
    57                 return fl_tbl[NUM_FL-1].fl; 
    58         else 
    59                 for (i=1; i<NUM_FL; ++i) { 
    60                         if (zp==fl_tbl[i-1].zp) 
    61                                 return fl_tbl[i-1].fl; 
    62                         else if (zp==fl_tbl[i].zp) 
    63                                 return fl_tbl[i].fl; 
    64                         else if (zp<fl_tbl[i].zp) 
    65                                 return fl_tbl[i-1].fl+(zp-fl_tbl[i-1].zp)*(fl_tbl[i].fl-fl_tbl[i-1].fl)/(fl_tbl[i].zp-fl_tbl[i-1].zp); 
    66                 } 
    67         return fl_tbl[NUM_FL-1].fl; 
    68 */ 
     50    if (zp < 0) zp = 0; 
     51    else if (zp >= NUM_FL) zp = NUM_FL-1; 
     52    return focus_len_table[zp*NUM_DATA]; 
    6953} 
    7054 
    71 //TODO 
    7255int get_zoom_x(int zp) { 
    73         return get_focal_length(zp)*10/focus_len_table[0]; 
    74         //return get_focal_length(zp)*10/fl_tbl[0].fl; 
     56    return get_focal_length(zp)*10/focus_len_table[0]; 
    7557} 
    76  
    7758 
    7859//TODO 
  • branches/reyalp-ptp-live/platform/sx230hs/notes.txt

    r1326 r1814  
    22SX230 HS Notes 
    33 
    4 To enter CHDK <Alt> mode use the DISP+SET button. 
     4To enter CHDK <Alt> mode use the playback button. 
    55 
    66Support for dual partition is not available. 
  • branches/reyalp-ptp-live/platform/sx230hs/sub/100c/stubs_entry.S

    r1658 r1814  
    5151DEF(focus_busy                              ,0x000083c4) // Found @0xff181c8c 
    5252//DEF(recreview_hold                          ,0x00004e04) // Found @0xff0a00d8, ** != ** stubs_min = 0x0000956c (0x947C+0xF0) 
     53DEF(palette_control                         ,0x0000b440) // Found @0xff24480c 
     54DEF(active_palette_buffer                   ,0x0000b448) // Found @0xff244810 
     55DEF(palette_buffer                          ,0x000ceb38) // Found @0xff244ce8 
     56DEF(bitmap_buffer                           ,0x0000b480) // Found @0xff249960 
     57DEF(active_bitmap_buffer                    ,0x0000b478) // Found @0xff249964 
    5358 
    5459// Values below go in 'lib.c': 
  • branches/reyalp-ptp-live/platform/sx230hs/sub/101a/stubs_entry.S

    r1658 r1814  
    5151DEF(focus_busy                              ,0x000083c4) // Found @0xff181e44 
    5252//DEF(recreview_hold                          ,0x00004e04) // Found @0xff0a0170, ** != ** stubs_min = 0x0000956c (0x947C+0xF0) 
     53DEF(palette_control                         ,0x0000b440) // Found @0xff244988 
     54DEF(active_palette_buffer                   ,0x0000b448) // Found @0xff24498c 
     55DEF(palette_buffer                          ,0x000ceb38) // Found @0xff244e64 
     56DEF(bitmap_buffer                           ,0x0000b480) // Found @0xff249ae4 
     57DEF(active_bitmap_buffer                    ,0x0000b478) // Found @0xff249ae8 
    5358 
    5459// Values below go in 'lib.c': 
  • branches/reyalp-ptp-live/platform/sx230hs/sub/101b/stubs_entry.S

    r1658 r1814  
    5151DEF(focus_busy                              ,0x000083c4) // Found @0xff181e44 
    5252//DEF(recreview_hold                          ,0x00004e04) // Found @0xff0a0170, ** != ** stubs_min = 0x0000956c (0x947C+0xF0) 
     53DEF(palette_control                         ,0x0000b440) // Found @0xff244988 
     54DEF(active_palette_buffer                   ,0x0000b448) // Found @0xff24498c 
     55DEF(palette_buffer                          ,0x000ceb38) // Found @0xff244e64 
     56DEF(bitmap_buffer                           ,0x0000b480) // Found @0xff249ae4 
     57DEF(active_bitmap_buffer                    ,0x0000b478) // Found @0xff249ae8 
    5358 
    5459// Values below go in 'lib.c': 
  • branches/reyalp-ptp-live/platform/sx30/kbd.c

    r1568 r1814  
    174174        } 
    175175 
     176    // Disable Zoom Assist button 
     177    if (conf.zoom_assist_button_disable) 
     178        physw_status[0] |= 0x00010000; 
     179 
    176180        //_kbd_read_keys_r2(physw_status); 
    177181 
  • branches/reyalp-ptp-live/platform/sx30/main.c

    r1565 r1814  
    3737 
    3838// Focus length table in firmware @ FFFEA5CC 
    39 #define NUM_FL 201              // 0 - 200, entries in firmware 
    40 extern int focus_len_table[NUM_FL]; 
     39#define NUM_FL      201 // 0 - 200, entries in firmware 
     40#define NUM_DATA    1   // 1 int value each entry 
     41extern int focus_len_table[NUM_FL*NUM_DATA]; 
    4142 
    4243// Conversion factor lens FL --> 35mm equiv 
    4344// lens      35mm     CF 
    4445// ----      ----     -- 
    45 // 4.3       24       (24/4.3) * 43 = 240  (min FL) 
     46// 4.3       24       ( 24/  4.3) * 43 = 240  (min FL) 
    4647// 150.5     840      (840/150.5) * 43 = 240  (max FL) 
    47 #define CF_EFL 240 
    48 #define CF_EFL_DIV 43 
     48#define CF_EFL      240 
     49#define CF_EFL_DIV  43 
    4950 
    50 const int zoom_points = 201; 
     51const int zoom_points = NUM_FL; 
    5152 
    5253int get_effective_focal_length(int zp) { 
    53         return (CF_EFL*get_focal_length(zp))/CF_EFL_DIV; 
     54    return (CF_EFL*get_focal_length(zp))/CF_EFL_DIV; 
    5455} 
    5556 
    5657int get_focal_length(int zp) { 
    57         if (zp < 0) zp = 0; 
    58         else if (zp >= NUM_FL) zp = NUM_FL-1; 
    59         return focus_len_table[zp]; 
     58    if (zp < 0) zp = 0; 
     59    else if (zp >= NUM_FL) zp = NUM_FL-1; 
     60    return focus_len_table[zp*NUM_DATA]; 
    6061} 
    6162 
    6263int get_zoom_x(int zp) { 
    63         return get_focal_length(zp)*10/focus_len_table[0]; 
     64    return get_focal_length(zp)*10/focus_len_table[0]; 
    6465} 
    6566 
  • branches/reyalp-ptp-live/platform/sx30/platform_camera.h

    r1711 r1814  
    127127    #define CAMERA_MAX_DIST                 9090910 // Override max subject distance 
    128128 
     129    #define CAM_ZOOM_ASSIST_BUTTON_CONTROL      1       // Activate the menu option to allow disabling the zoom assist button 
     130 
    129131//---------------------------------------------------------- 
    130132 
  • branches/reyalp-ptp-live/platform/sx30/sub/100e/stubs_entry.S

    r1641 r1814  
    4141DEF(focus_busy                              ,0x00007a70) // Found @0xff97df04 
    4242DEF(recreview_hold                          ,0x0000468c) // Found @0xff8ac610 
     43DEF(palette_control                         ,0x0000b198) // Found @0xffa46818 
     44DEF(active_palette_buffer                   ,0x0000b1a0) // Found @0xffa4681c 
     45DEF(palette_buffer                          ,0x000cf9b4) // Found @0xffa46d50 
     46DEF(bitmap_buffer                           ,0x0000b1d4) // Found @0xffa4a7a8 
     47DEF(active_bitmap_buffer                    ,0x0000b1cc) // Found @0xffa4a7ac 
    4348 
    4449// Values below go in 'lib.c': 
  • branches/reyalp-ptp-live/platform/sx30/sub/100e/stubs_min.S

    r1641 r1814  
    33DEF(rear_dial_position,                 0xC0240106) 
    44 
    5 DEF(active_bitmap_buffer,               0xB1CC)         // 0xB1B8+0x14 (1.00e sub_FFA4A758 -> FFA4A75C + FFA4A7AC) 
    6 DEF(bitmap_buffer,                      0xB1D4)         // FFA4A7A8 
    7 DEF(palette_control,                    0xB198)         // sub_FFA4698C (1.00h) 
    8 DEF(active_palette_buffer,              0xB1A0)         // sub_FFA468D4 (1.00h) 
    9 DEF(palette_buffer,                     0xCF9B4)        // sub_FFA46DC8 (1.00h) 
    105DEF(viewport_buffers,                   0xFFB96808)     // 1.00h sub_FF851C44 (FF851F2C) 
    116DEF(active_viewport_buffer,             0x20A8)         // 1.00h sub_FF851C44 (FF851C48 & FF851F58) 
  • branches/reyalp-ptp-live/platform/sx30/sub/100h/stubs_entry.S

    r1641 r1814  
    4141DEF(focus_busy                              ,0x00007a74) // Found @0xff97df38 
    4242DEF(recreview_hold                          ,0x0000468c) // Found @0xff8ac610 
     43DEF(palette_control                         ,0x0000b198) // Found @0xffa468d4 
     44DEF(active_palette_buffer                   ,0x0000b1a0) // Found @0xffa468d8 
     45DEF(palette_buffer                          ,0x000cf9b4) // Found @0xffa46e0c 
     46DEF(bitmap_buffer                           ,0x0000b1d4) // Found @0xffa4a864 
     47DEF(active_bitmap_buffer                    ,0x0000b1cc) // Found @0xffa4a868 
    4348 
    4449// Values below go in 'lib.c': 
  • branches/reyalp-ptp-live/platform/sx30/sub/100h/stubs_min.S

    r1641 r1814  
    33DEF(rear_dial_position,                 0xC0240106) 
    44 
    5 DEF(active_bitmap_buffer,               0xB1CC)         // 0xB1B8+0x14 (1.00h sub_FFA4A814 -> FFA4A818 + FFA4A868) 
    6 DEF(bitmap_buffer,                      0xB1D4)         // FFA4A864 
    7 DEF(palette_control,                    0xB198)         // sub_FFA4698C (1.00h) 
    8 DEF(active_palette_buffer,              0xB1A0)         // sub_FFA468D4 (1.00h) 
    9 DEF(palette_buffer,                     0xCF9B4)        // sub_FFA46DC8 (1.00h) 
    105DEF(viewport_buffers,                   0xFFB968C4)     // 1.00h sub_FF851C44 (FF851F2C) 
    116DEF(active_viewport_buffer,             0x20A8)         // 1.00h sub_FF851C44 (FF851C48 & FF851F58) 
  • branches/reyalp-ptp-live/platform/sx30/sub/100l/stubs_entry.S

    r1641 r1814  
    4141DEF(focus_busy                              ,0x00007a74) // Found @0xff97df3c 
    4242DEF(recreview_hold                          ,0x0000468c) // Found @0xff8ac614 
     43DEF(palette_control                         ,0x0000b198) // Found @0xffa46a7c 
     44DEF(active_palette_buffer                   ,0x0000b1a0) // Found @0xffa46a80 
     45DEF(palette_buffer                          ,0x000cf9b4) // Found @0xffa46fb4 
     46DEF(bitmap_buffer                           ,0x0000b1d4) // Found @0xffa4aa0c 
     47DEF(active_bitmap_buffer                    ,0x0000b1cc) // Found @0xffa4aa10 
    4348 
    4449// Values below go in 'lib.c': 
  • branches/reyalp-ptp-live/platform/sx30/sub/100l/stubs_min.S

    r1641 r1814  
    33DEF(rear_dial_position,                 0xC0240106) 
    44 
    5 DEF(active_bitmap_buffer,               0xB1CC)         // 0xB1B8+0x14 (1.00l sub_FFA4A9BC -> FFA4A9C0 + FFA4AA10) 
    6 DEF(bitmap_buffer,                      0xB1D4)         // FFA4AA0C 
    7 DEF(palette_control,                    0xB198)         // sub_FFA4698C (1.00h) 
    8 DEF(active_palette_buffer,              0xB1A0)         // sub_FFA468D4 (1.00h) 
    9 DEF(palette_buffer,                     0xCF9B4)        // sub_FFA46DC8 (1.00h) 
    105DEF(viewport_buffers,                   0xFFB96A6C)     // 1.00h sub_FF851C44 (FF851F2C) 
    116DEF(active_viewport_buffer,             0x20A8)         // 1.00h sub_FF851C44 (FF851C48 & FF851F58) 
  • branches/reyalp-ptp-live/platform/sx30/sub/100n/stubs_entry.S

    r1641 r1814  
    4141DEF(focus_busy                              ,0x00007a74) // Found @0xff97dfc0 
    4242DEF(recreview_hold                          ,0x0000468c) // Found @0xff8ac614 
     43DEF(palette_control                         ,0x0000b198) // Found @0xffa46b00 
     44DEF(active_palette_buffer                   ,0x0000b1a0) // Found @0xffa46b04 
     45DEF(palette_buffer                          ,0x000cf9b4) // Found @0xffa47038 
     46DEF(bitmap_buffer                           ,0x0000b1d4) // Found @0xffa4aa90 
     47DEF(active_bitmap_buffer                    ,0x0000b1cc) // Found @0xffa4aa94 
    4348 
    4449// Values below go in 'lib.c': 
  • branches/reyalp-ptp-live/platform/sx30/sub/100n/stubs_min.S

    r1641 r1814  
    33DEF(rear_dial_position,                 0xC0240106) 
    44 
    5 DEF(active_bitmap_buffer,               0xB1CC)         // 0xB1B8+0x14 (1.00n sub_FFA4AA40 -> FFA4AA44 + FFA4AA94) 
    6 DEF(bitmap_buffer,                      0xB1D4)         // FFA4AA90 
    7 DEF(palette_control,                    0xB198)         // sub_FFA4698C (1.00h) 
    8 DEF(active_palette_buffer,              0xB1A0)         // sub_FFA468D4 (1.00h) 
    9 DEF(palette_buffer,                     0xCF9B4)        // sub_FFA46DC8 (1.00h) 
    105DEF(viewport_buffers,                   0xFFB96AE0)     // 1.00h sub_FF851C44 (FF851F2C) 
    116DEF(active_viewport_buffer,             0x20A8)         // 1.00h sub_FF851C44 (FF851C48 & FF851F58) 
  • branches/reyalp-ptp-live/platform/sx30/sub/100p/stubs_entry.S

    r1641 r1814  
    4141DEF(focus_busy                              ,0x00007a74) // Found @0xff97dfc0 
    4242DEF(recreview_hold                          ,0x0000468c) // Found @0xff8ac614 
     43DEF(palette_control                         ,0x0000b198) // Found @0xffa46b00 
     44DEF(active_palette_buffer                   ,0x0000b1a0) // Found @0xffa46b04 
     45DEF(palette_buffer                          ,0x000cf9b4) // Found @0xffa47038 
     46DEF(bitmap_buffer                           ,0x0000b1d4) // Found @0xffa4aa90 
     47DEF(active_bitmap_buffer                    ,0x0000b1cc) // Found @0xffa4aa94 
    4348 
    4449// Values below go in 'lib.c': 
  • branches/reyalp-ptp-live/platform/sx30/sub/100p/stubs_min.S

    r1641 r1814  
    33DEF(rear_dial_position,                 0xC0240106) 
    44 
    5 DEF(active_bitmap_buffer,               0xB1CC)         // 0xB1B8+0x14 (1.00p sub_FFA4AA40 -> FFA4AA44 + FFA4AA94) 
    6 DEF(bitmap