Changeset 1512


Ignore:
Timestamp:
12/28/11 22:34:31 (17 months ago)
Author:
philmoz
Message:

Add 'camera_info' struct for module platform independance (for review).

Location:
branches/reyalp-flt
Files:
28 edited

Legend:

Unmodified
Added
Removed
  • branches/reyalp-flt/core/console.c

    r1493 r1512  
    131131    { 
    132132        int y = (console_y + console_max_lines - console_num_lines) * FONT_HEIGHT; 
    133         int x = console_x * FONT_WIDTH + CAM_TS_BUTTON_BORDER; 
     133        int x = console_x * FONT_WIDTH + camera_info.ts_button_border; 
    134134 
    135135        for(c = 0; c < console_num_lines; ++c) 
  • branches/reyalp-flt/core/curves.c

    r1494 r1512  
    146146         
    147147        // Loop through picture rows 
    148         for (i=CAM_CHDK_RAW_ROWS; i;i-=2){ 
     148        for (i=camera_info.raw_rows; i;i-=2){ 
    149149                // Loop through picture columns  
    150                 for (j=CAM_CHDK_RAW_ROWPIX; j; j-=8, src+=10){ 
     150                for (j=camera_info.raw_rows; j; j-=8, src+=10){ 
    151151                        pixVal0=((0x3fc&(((unsigned short)(src[1]))<<2)) | (src[0] >> 6)); 
    152152                        pixVal1=((0x3f0&(((unsigned short)(src[0]))<<4)) | (src[3] >> 4)); 
     
    179179            *(src+8) = (unsigned char) ((pixVal0)); //7 (=>0)           } 
    180180                } 
    181                 for (j=CAM_CHDK_RAW_ROWPIX;j; j-=8, src+=10){ 
     181                for (j=camera_info.raw_rows;j; j-=8, src+=10){ 
    182182                        pixVal0=((0x3fc&(((unsigned short)(src[1]))<<2)) | (src[0] >> 6)); 
    183183                        pixVal1=((0x3f0&(((unsigned short)(src[0]))<<4)) | (src[3] >> 4)); 
     
    242242         
    243243        // Loop through picture rows 
    244         for (i=CAM_CHDK_RAW_ROWS; i;i-=2){ 
     244        for (i=camera_info.raw_rows; i;i-=2){ 
    245245                // Loop through picture columns  
    246                 for (j=CAM_CHDK_RAW_ROWPIX; j; j-=8, src+=10){ 
     246                for (j=camera_info.raw_rows; j; j-=8, src+=10){ 
    247247                        pixVal0=((0x3fc&(((unsigned short)(src[1]))<<2)) | (src[0] >> 6)); 
    248248                        pixVal1=((0x3f0&(((unsigned short)(src[0]))<<4)) | (src[3] >> 4)); 
     
    307307            *(src+8) = (unsigned char) ((pixVal0)); //7 (=>0) 
    308308                } 
    309                 for (j=CAM_CHDK_RAW_ROWPIX;j; j-=8, src+=10){ 
     309                for (j=camera_info.raw_rows;j; j-=8, src+=10){ 
    310310                        pixVal0=((0x3fc&(((unsigned short)(src[1]))<<2)) | (src[0] >> 6)); 
    311311                        pixVal1=((0x3f0&(((unsigned short)(src[0]))<<4)) | (src[3] >> 4)); 
  • branches/reyalp-flt/core/dng.c

    r1511 r1512  
    11#include "camera.h" 
    2  
    3 #if DNG_SUPPORT 
    42 
    53#include "stdlib.h" 
     
    75#include "platform.h" 
    86#include "conf.h" 
    9 #include "console.h" 
    107#include "console.h" 
    118#include "dng.h" 
     
    2219struct dir_entry{unsigned short tag; unsigned short type; unsigned int count; unsigned int offset;}; 
    2320 
    24 #define T_BYTE 1 
    25 #define T_ASCII 2 
    26 #define T_SHORT 3 
    27 #define T_LONG 4 
    28 #define T_RATIONAL 5 
    29 #define T_SBYTE 6 
     21#define T_BYTE      1 
     22#define T_ASCII     2 
     23#define T_SHORT     3 
     24#define T_LONG      4 
     25#define T_RATIONAL  5 
     26#define T_SBYTE     6 
    3027#define T_UNDEFINED 7 
    31 #define T_SSHORT 8 
    32 #define T_SLONG 9 
     28#define T_SSHORT    8 
     29#define T_SLONG     9 
    3330#define T_SRATIONAL 10 
    34 #define T_FLOAT 11 
    35 #define T_DOUBLE 12 
    36  
    37 #define CAM_DEFAULT_CROP_ORIGIN_W ((CAM_ACTIVE_AREA_X2-CAM_ACTIVE_AREA_X1-CAM_JPEG_WIDTH )/2) 
    38 #define CAM_DEFAULT_CROP_ORIGIN_H ((CAM_ACTIVE_AREA_Y2-CAM_ACTIVE_AREA_Y1-CAM_JPEG_HEIGHT)/2) 
     31#define T_FLOAT     11 
     32#define T_DOUBLE    12 
     33#define T_PTR       0x100   // Stored as long/short etc in DNG header, referenced by pointer in IFD (must be pointer to int variable) 
    3934 
    4035unsigned short get_exp_program_for_exif(int exp_program); 
     
    4338unsigned short get_metering_mode_for_exif(short metering_mode); 
    4439 
    45 const int cam_DefaultCropSize[]={CAM_JPEG_WIDTH, CAM_JPEG_HEIGHT};    // jpeg size 
    46 const int cam_ActiveArea[]={CAM_ACTIVE_AREA_Y1, CAM_ACTIVE_AREA_X1, CAM_ACTIVE_AREA_Y2, CAM_ACTIVE_AREA_X2}; 
    47 const int cam_DefaultCropOrigin[]={CAM_DEFAULT_CROP_ORIGIN_W,CAM_DEFAULT_CROP_ORIGIN_H}; 
    48 #if defined(CAM_DNG_LENS_INFO) 
    49 const int cam_lensinfo[] = CAM_DNG_LENS_INFO; 
    50 #endif 
    51 #if defined(CAM_DNG_EXPOSURE_BIAS) 
    52 const int cam_BaselineExposure[]={CAM_DNG_EXPOSURE_BIAS}; 
    53 #else 
    54 const int cam_BaselineExposure[]={-1,2}; 
    55 #endif 
    56 const int cam_BaselineNoise[]={1,1}; 
    57 const int cam_BaselineSharpness[]={4,3}; 
    58 const int cam_LinearResponseLimit[]={1,1}; 
    59 const int cam_AnalogBalance[]={1,1,1,1,1,1}; 
    60 const int cam_ColorMatrix1[9*2]={CAM_COLORMATRIX1}; 
     40const int cam_BaselineNoise[]           = {1,1}; 
     41const int cam_BaselineSharpness[]       = {4,3}; 
     42const int cam_LinearResponseLimit[]     = {1,1}; 
     43const int cam_AnalogBalance[]           = {1,1,1,1,1,1}; 
    6144const char cam_name[32]; 
    62 const short cam_PreviewBitsPerSample[]={8,8,8}; 
    63 const char cam_chdk_ver[]=HDK_VERSION" ver. "BUILD_NUMBER; 
    64 const int cam_Resolution[]={180,1}; 
    65 int cam_AsShotNeutral[]={1000,1000,1000,1000,1000,1000}; 
    66  
    67 // warning: according to TIFF format specification, elements must be sorted by tag value in ascending order! 
    68  
    69 struct dir_entry IFD0[]={ 
    70  {0xFE,   T_LONG,      1,  1},       // NewSubFileType: Preview Image 
    71  {0x100,  T_LONG,      1,  DNG_TH_WIDTH},   // ImageWidth 
    72  {0x101,  T_LONG,      1,  DNG_TH_HEIGHT},   // ImageLength 
    73  {0x102,  T_SHORT,     3,  (int)cam_PreviewBitsPerSample},   // BitsPerSample: 8,8,8 
    74  {0x103,  T_SHORT,     1,  1},   // Compression: Uncompressed 
    75  {0x106,  T_SHORT,     1,  2}, //PhotometricInterpretation: RGB 
    76  {0x10E,  T_ASCII,     1,  0}, // ImageDescription 
    77  {0x10F,  T_ASCII,     sizeof(CAM_MAKE),  (int)CAM_MAKE}, // Make 
    78  {0x110,  T_ASCII,     32, (int)cam_name}, //Model: Filled at header generation. 
    79  {0x111,  T_LONG,      1,  0}, //StripOffsets: Offset 
    80  {0x112,  T_SHORT,     1,  1}, //Orientation: 1 - 0th row is top, 0th column is left 
    81  {0x115,  T_SHORT,     1,  3}, // SamplesPerPixel: 3 
    82  {0x116,  T_SHORT,     1,  DNG_TH_HEIGHT}, //RowsPerStrip 
    83  {0x117,  T_LONG,      1,  DNG_TH_WIDTH*DNG_TH_HEIGHT*3}, // StripByteCounts = preview size 
    84  {0x11C,  T_SHORT,     1,  1}, // PlanarConfiguration: 1 
    85  {0x131,  T_ASCII,     sizeof(cam_chdk_ver),  (int)cam_chdk_ver}, //Software 
    86  {0x132,  T_ASCII,     20, 0}, // DateTime 
    87  {0x14A,  T_LONG,      1,  0}, //SubIFDs offset 
    88  {0x8298, T_ASCII,     1,  0}, // Copyright 
    89  {0x8769, T_LONG,      1,  0}, //EXIF_IFD offset 
    90 #if defined(OPT_GPS) 
    91  {0x8825, T_LONG,      1,  0}, //GPS_IFD offset 
    92 #endif 
    93  {0x9216, T_BYTE,      4,  0x00000001},  // TIFF/EPStandardID: 1.0.0.0 
    94  {0xC612, T_BYTE,      4,  0x00000101}, //DNGVersion: 1.1.0.0 
    95  {0xC614, T_ASCII,     32, (int)cam_name}, //UniqueCameraModel. Filled at header generation. 
    96  {0xC621, T_SRATIONAL, 9,  (int)cam_ColorMatrix1}, 
    97  {0xC627, T_RATIONAL,  3,  (int)cam_AnalogBalance}, 
    98  {0xC628, T_RATIONAL,  3,  (int)cam_AsShotNeutral}, 
    99  {0xC62A, T_SRATIONAL, 1,  (int)cam_BaselineExposure}, 
    100  {0xC62B, T_RATIONAL,  1,  (int)cam_BaselineNoise}, 
    101  {0xC62C, T_RATIONAL,  1,  (int)cam_BaselineSharpness}, 
    102  {0xC62E, T_RATIONAL,  1,  (int)cam_LinearResponseLimit}, 
    103 #if defined(CAM_DNG_LENS_INFO) 
    104  {0xC630, T_RATIONAL,  4,  (int)cam_lensinfo}, 
    105 #endif 
    106  {0xC65A, T_SHORT,     1,  cam_CalibrationIlluminant1},  
    107  {0} 
    108 }; 
    109  
    110                                                                                        
    111 struct dir_entry IFD1[]={ 
    112  {0xFE,   T_LONG,      1,  0},       // NewSubFileType: Main Image 
    113  {0x100,  T_LONG,      1,  CAM_RAW_ROWPIX},   // ImageWidth 
    114  {0x101,  T_LONG,      1,  CAM_RAW_ROWS},   // ImageLength 
    115  {0x102,  T_SHORT,     1,  CAM_SENSOR_BITS_PER_PIXEL},   // BitsPerSample 
    116  {0x103,  T_SHORT,     1,  1},   // Compression: Uncompressed 
    117  {0x106,  T_SHORT,     1,  0x8023}, //PhotometricInterpretation: CFA 
    118  {0x111,  T_LONG,      1,  0}, //StripOffsets: Offset 
    119  {0x115,  T_SHORT,     1,  1}, // SamplesPerPixel: 1 
    120  {0x116,  T_SHORT,     1,  CAM_RAW_ROWS}, //RowsPerStrip 
    121  {0x117,  T_LONG,      1,  CAM_RAW_ROWS*RAW_ROWLEN}, // StripByteCounts = CHDK RAW size 
    122  {0x11A,  T_RATIONAL,  1,  (int)cam_Resolution}, // XResolution 
    123  {0x11B,  T_RATIONAL,  1,  (int)cam_Resolution}, // YResolution 
    124  {0x11C,  T_SHORT,     1,  1}, // PlanarConfiguration: 1 
    125  {0x128,  T_SHORT,     1,  2}, // ResolutionUnit: inch 
    126  {0x828D, T_SHORT,     2,  0x00020002}, // CFARepeatPatternDim: Rows = 2, Cols = 2 
    127  {0x828E, T_BYTE,      4,  cam_CFAPattern}, 
    128  {0xC61A, T_LONG,      1,  CAM_BLACK_LEVEL}, // BlackLevel 
    129  {0xC61D, T_LONG,      1,  CAM_WHITE_LEVEL}, // WhiteLevel 
    130  {0xC61F, T_LONG,      2,  (int)cam_DefaultCropOrigin}, 
    131  {0xC620, T_LONG,      2,  (int)cam_DefaultCropSize}, 
    132  {0xC68D, T_LONG,      4,  (int)cam_ActiveArea}, 
    133  {0} 
    134 }; 
    135  
    136  
    137 static int cam_shutter[2]       = { 0, 1000000 };       // Shutter speed 
    138 static int cam_aperture[2]      = { 0, 10 };            // Aperture 
    139 static char cam_datetime[20]    = "";                   // DateTimeOriginal 
    140 static int cam_apex_shutter[2]  = { 0, 96 };            // Shutter speed in APEX units 
    141 static int cam_apex_aperture[2] = { 0, 96 };            // Aperture in APEX units 
    142 static int cam_exp_bias[2]      = { 0, 96 }; 
    143 static int cam_max_av[2]        = { 0, 96 }; 
    144 static int cam_focal_length[2]  = { 0, 1000 }; 
    145  
    146 struct dir_entry EXIF_IFD[]={ 
    147  {0x829A, T_RATIONAL,  1,  (int)cam_shutter},           // Shutter speed 
    148  {0x829D, T_RATIONAL,  1,  (int)cam_aperture},          // Aperture 
    149  {0x8822, T_SHORT,     1,  0},                          // ExposureProgram 
    150  {0x8827, T_SHORT,     1,  0},                          // ISOSpeedRatings 
    151  {0x9000, T_UNDEFINED, 4,  0x31323230},                 // ExifVersion: 2.21 
    152  {0x9003, T_ASCII,     20, (int)cam_datetime},          // DateTimeOriginal 
    153  {0x9201, T_SRATIONAL, 1,  (int)cam_apex_shutter},      // ShutterSpeedValue (APEX units) 
    154  {0x9202, T_RATIONAL,  1,  (int)cam_apex_aperture},     // ApertureValue (APEX units) 
    155  {0x9204, T_SRATIONAL, 1,  (int)cam_exp_bias},          // ExposureBias 
    156  {0x9205, T_RATIONAL,  1,  (int)cam_max_av},            // MaxApertureValue 
    157  {0x9207, T_SHORT,     1,  0},                          // Metering mode 
    158  {0x9209, T_SHORT,     1,  0},                          // Flash mode 
    159  {0x920A, T_RATIONAL,  1,  (int)cam_focal_length},      // FocalLength 
    160  {0xA405, T_SHORT,     1,  0},                          // FocalLengthIn35mmFilm 
    161  {0} 
    162 }; 
    163  
    164  
    165 #if defined(OPT_GPS) 
    166 struct dir_entry GPS_IFD[]={ 
    167 // {0x0000, T_BYTE,      4,  0x00000302}, //GPSVersionID: 2 3 0 0 
    168  {0x0001, T_ASCII,     2,  0}, //North or South Latitude "N\0" or "S\0" 
    169  {0x0002, T_RATIONAL,  3,  0}, //Latitude 
    170  {0x0003, T_ASCII,     2,  0}, //East or West Latitude "E\0" or "W\0" 
    171  {0x0004, T_RATIONAL,  3,  0}, //Longitude 
    172  {0x0005, T_ASCII,     2,  0}, //AltitudeRef 
    173  {0x0006, T_RATIONAL,  3,  0}, //Altitude 
    174  {0x0007, T_RATIONAL,  3,  0}, //TimeStamp 
    175  {0x0009, T_ASCII,     2,  0}, //Status 
    176 // {0x000A, T_ASCII,     1,  0}, //MeasureMode 
    177  {0x0012, T_ASCII,     8,  0}, //MapDatum 7 + 1 pad byte 
    178  {0x001D, T_ASCII,    12,  0}, //DateStamp 11 + 1 pad byte 
    179  {0} 
    180 }; 
    181 #endif 
    182  
    183  
    184 int get_type_size(int type){ 
    185  switch(type){ 
    186   case T_BYTE:      return 1; 
    187   case T_ASCII:     return 1;  
    188   case T_SHORT:     return 2; 
    189   case T_LONG:      return 4; 
    190   case T_RATIONAL:  return 8; 
    191   case T_SBYTE:     return 1; 
    192   case T_UNDEFINED: return 1; 
    193   case T_SSHORT:    return 2; 
    194   case T_SLONG:     return 4; 
    195   case T_SRATIONAL: return 8; 
    196   case T_FLOAT:     return 4; 
    197   case T_DOUBLE:    return 8; 
    198   default: return 0; 
    199  } 
    200 } 
    201  
    202 #if defined(OPT_GPS) 
    203 struct {struct dir_entry* entry; int count;} IFD_LIST[]={{IFD0,0}, {IFD1,0}, {EXIF_IFD,0}, {GPS_IFD, 0}}; 
    204 #else 
    205 struct {struct dir_entry* entry; int count;} IFD_LIST[]={{IFD0,0}, {IFD1,0}, {EXIF_IFD,0}}; 
    206 #endif 
    207  
    208 #define IFDs (sizeof(IFD_LIST)/sizeof(IFD_LIST[0])) 
    209  
    210 #define TIFF_HDR_SIZE (8) 
    211  
    212 char* dng_header_buf; 
    213 int dng_header_buf_size; 
    214 int dng_header_buf_offset; 
    215 char *thumbnail_buf; 
    216  
    217 void add_to_buf(void* var, int size) 
    218 { 
    219  memcpy(dng_header_buf+dng_header_buf_offset,var,size); 
    220  dng_header_buf_offset+=size; 
    221 } 
     45const short cam_PreviewBitsPerSample[]  = {8,8,8}; 
     46const char cam_chdk_ver[]               = HDK_VERSION" ver. "BUILD_NUMBER; 
     47const int cam_Resolution[]              = {180,1}; 
     48int cam_AsShotNeutral[]                 = {1000,1000,1000,1000,1000,1000}; 
    22249 
    22350struct t_data_for_exif{ 
     
    23360static struct t_data_for_exif exif_data; 
    23461 
     62// warning: according to TIFF format specification, elements must be sorted by tag value in ascending order! 
     63 
     64struct dir_entry IFD0[]={ 
     65 {0xFE,   T_LONG,       1,  1},                                 // NewSubFileType: Preview Image 
     66 {0x100,  T_LONG,       1,  DNG_TH_WIDTH},                      // ImageWidth 
     67 {0x101,  T_LONG,       1,  DNG_TH_HEIGHT},                     // ImageLength 
     68 {0x102,  T_SHORT,      3,  (int)cam_PreviewBitsPerSample},     // BitsPerSample: 8,8,8 
     69 {0x103,  T_SHORT,      1,  1},                                 // Compression: Uncompressed 
     70 {0x106,  T_SHORT,      1,  2},                                 //PhotometricInterpretation: RGB 
     71 {0x10E,  T_ASCII,      1,  0},                                 // ImageDescription 
     72 {0x10F,  T_ASCII,      sizeof(CAM_MAKE), (int)CAM_MAKE},       // Make 
     73 {0x110,  T_ASCII,      32, (int)cam_name},                     //Model: Filled at header generation. 
     74 {0x111,  T_LONG,       1,  0},                                 //StripOffsets: Offset 
     75 {0x112,  T_SHORT,      1,  1},                                 //Orientation: 1 - 0th row is top, 0th column is left 
     76 {0x115,  T_SHORT,      1,  3},                                 // SamplesPerPixel: 3 
     77 {0x116,  T_SHORT,      1,  DNG_TH_HEIGHT},                     //RowsPerStrip 
     78 {0x117,  T_LONG,       1,  DNG_TH_WIDTH*DNG_TH_HEIGHT*3},      // StripByteCounts = preview size 
     79 {0x11C,  T_SHORT,      1,  1},                                 // PlanarConfiguration: 1 
     80 {0x131,  T_ASCII,      sizeof(cam_chdk_ver), (int)cam_chdk_ver},//Software 
     81 {0x132,  T_ASCII,      20, 0},                                 // DateTime 
     82 {0x14A,  T_LONG,       1,  0},                                 //SubIFDs offset 
     83 {0x8298, T_ASCII,      1,  0},                                 // Copyright 
     84 {0x8769, T_LONG,       1,  0},                                 //EXIF_IFD offset 
     85 {0x8825, T_LONG,       1,  0},                                 //GPS_IFD offset 
     86 {0x9216, T_BYTE,       4,  0x00000001},                        // TIFF/EPStandardID: 1.0.0.0 
     87 {0xC612, T_BYTE,       4,  0x00000101},                        //DNGVersion: 1.1.0.0 
     88 {0xC614, T_ASCII,      32, (int)cam_name},                     //UniqueCameraModel. Filled at header generation. 
     89 {0xC621, T_SRATIONAL,  9,  (int)&camera_info.color_matrix1}, 
     90 {0xC627, T_RATIONAL,   3,  (int)cam_AnalogBalance}, 
     91 {0xC628, T_RATIONAL,   3,  (int)cam_AsShotNeutral}, 
     92 {0xC62A, T_SRATIONAL,  1,  (int)&camera_info.exposure_bias}, 
     93 {0xC62B, T_RATIONAL,   1,  (int)cam_BaselineNoise}, 
     94 {0xC62C, T_RATIONAL,   1,  (int)cam_BaselineSharpness}, 
     95 {0xC62E, T_RATIONAL,   1,  (int)cam_LinearResponseLimit}, 
     96 {0xC630, T_RATIONAL,   4,  (int)&camera_info.lens_info}, 
     97 {0xC65A, T_SHORT|T_PTR,1,  (int)&camera_info.calibration_illuminant1},  
     98 {0} 
     99}; 
     100 
     101                                                                                       
     102struct dir_entry IFD1[]={ 
     103 {0xFE,   T_LONG,       1,  0},                                 // NewSubFileType: Main Image 
     104 {0x100,  T_LONG|T_PTR, 1,  (int)&camera_info.raw_rowpix},      // ImageWidth 
     105 {0x101,  T_LONG|T_PTR, 1,  (int)&camera_info.raw_rows},        // ImageLength 
     106 {0x102,  T_SHORT|T_PTR,1,  (int)&camera_info.bits_per_pixel},  // BitsPerSample 
     107 {0x103,  T_SHORT,      1,  1},                                 // Compression: Uncompressed 
     108 {0x106,  T_SHORT,      1,  0x8023},                            //PhotometricInterpretation: CFA 
     109 {0x111,  T_LONG,       1,  0},                                 //StripOffsets: Offset 
     110 {0x115,  T_SHORT,      1,  1},                                 // SamplesPerPixel: 1 
     111 {0x116,  T_SHORT|T_PTR,1,  (int)&camera_info.raw_rows},        //RowsPerStrip 
     112 {0x117,  T_LONG|T_PTR, 1,  (int)&camera_info.raw_size},        // StripByteCounts = CHDK RAW size 
     113 {0x11A,  T_RATIONAL,   1,  (int)cam_Resolution},               // XResolution 
     114 {0x11B,  T_RATIONAL,   1,  (int)cam_Resolution},               // YResolution 
     115 {0x11C,  T_SHORT,      1,  1},                                 // PlanarConfiguration: 1 
     116 {0x128,  T_SHORT,      1,  2},                                 // ResolutionUnit: inch 
     117 {0x828D, T_SHORT,      2,  0x00020002},                        // CFARepeatPatternDim: Rows = 2, Cols = 2 
     118 {0x828E, T_BYTE|T_PTR, 4,  (int)&camera_info.cfa_pattern}, 
     119 {0xC61A, T_LONG|T_PTR, 1,  (int)&camera_info.black_level},     // BlackLevel 
     120 {0xC61D, T_LONG|T_PTR, 1,  (int)&camera_info.white_level},     // WhiteLevel 
     121 {0xC61F, T_LONG,       2,  (int)&camera_info.crop.origin}, 
     122 {0xC620, T_LONG,       2,  (int)&camera_info.crop.size}, 
     123 {0xC68D, T_LONG,       4,  (int)&camera_info.dng_active_area}, 
     124 {0} 
     125}; 
     126 
     127 
     128static int cam_shutter[2]       = { 0, 1000000 };       // Shutter speed 
     129static int cam_aperture[2]      = { 0, 10 };            // Aperture 
     130static char cam_datetime[20]    = "";                   // DateTimeOriginal 
     131static int cam_apex_shutter[2]  = { 0, 96 };            // Shutter speed in APEX units 
     132static int cam_apex_aperture[2] = { 0, 96 };            // Aperture in APEX units 
     133static int cam_exp_bias[2]      = { 0, 96 }; 
     134static int cam_max_av[2]        = { 0, 96 }; 
     135static int cam_focal_length[2]  = { 0, 1000 }; 
     136 
     137struct dir_entry EXIF_IFD[]={ 
     138 {0x829A, T_RATIONAL,   1,  (int)cam_shutter},          // Shutter speed 
     139 {0x829D, T_RATIONAL,   1,  (int)cam_aperture},         // Aperture 
     140 {0x8822, T_SHORT,      1,  0},                         // ExposureProgram 
     141 {0x8827, T_SHORT|T_PTR,1,  (int)&exif_data.iso},       // ISOSpeedRatings 
     142 {0x9000, T_UNDEFINED,  4,  0x31323230},                // ExifVersion: 2.21 
     143 {0x9003, T_ASCII,      20, (int)cam_datetime},         // DateTimeOriginal 
     144 {0x9201, T_SRATIONAL,  1,  (int)cam_apex_shutter},     // ShutterSpeedValue (APEX units) 
     145 {0x9202, T_RATIONAL,   1,  (int)cam_apex_aperture},    // ApertureValue (APEX units) 
     146 {0x9204, T_SRATIONAL,  1,  (int)cam_exp_bias},         // ExposureBias 
     147 {0x9205, T_RATIONAL,   1,  (int)cam_max_av},           // MaxApertureValue 
     148 {0x9207, T_SHORT,      1,  0},                         // Metering mode 
     149 {0x9209, T_SHORT,      1,  0},                         // Flash mode 
     150 {0x920A, T_RATIONAL,   1,  (int)cam_focal_length},     // FocalLength 
     151 {0xA405, T_SHORT|T_PTR,1,  (int)&exif_data.effective_focal_length},    // FocalLengthIn35mmFilm 
     152 {0} 
     153}; 
     154 
     155   
     156typedef struct { 
     157    char    latitudeRef[4]; 
     158    int     latitude[6]; 
     159    char    longitudeRef[4]; 
     160    int     longitude[6]; 
     161    char    heightRef[4]; 
     162    int     height[2]; 
     163    int     timeStamp[6]; 
     164    char    status[4]; 
     165    char    mapDatum[8]; 
     166    char    dateStamp[12]; 
     167    char    unknown2[260]; 
     168} tGPS; 
     169tGPS gps_data; 
     170 
     171struct dir_entry GPS_IFD[]={ 
     172//{0x0000, T_BYTE,              4,  0x00000302},                    //GPSVersionID: 2 3 0 0 
     173  {0x0001, T_ASCII,             2,  (int)gps_data.latitudeRef},     //North or South Latitude "N\0" or "S\0" 
     174  {0x0002, T_RATIONAL,          3,  (int)gps_data.latitude},        //Latitude 
     175  {0x0003, T_ASCII,             2,  (int)gps_data.longitudeRef},    //East or West Latitude "E\0" or "W\0" 
     176  {0x0004, T_RATIONAL,          3,  (int)gps_data.longitude},       //Longitude 
     177  {0x0005, T_BYTE,              1,  (int)gps_data.heightRef},       //AltitudeRef 
     178  {0x0006, T_RATIONAL,          1,  (int)gps_data.height},          //Altitude 
     179  {0x0007, T_RATIONAL,          3,  (int)gps_data.timeStamp},       //TimeStamp 
     180  {0x0009, T_ASCII,             2,  (int)gps_data.status},          //Status 
     181//{0x000A, T_ASCII,             1,  0},                             //MeasureMode 
     182  {0x0012, T_ASCII,             7,  (int)gps_data.mapDatum},        //MapDatum 7 + 1 pad byte 
     183  {0x001D, T_ASCII,             11, (int)gps_data.dateStamp},       //DateStamp 11 + 1 pad byte 
     184  {0} 
     185}; 
     186 
     187 
     188int get_type_size(int type){ 
     189 switch(type & 0xFF){ 
     190  case T_BYTE: 
     191  case T_SBYTE: 
     192  case T_UNDEFINED: 
     193  case T_ASCII:     return 1;  
     194  case T_SHORT: 
     195  case T_SSHORT:    return 2; 
     196  case T_LONG: 
     197  case T_SLONG: 
     198  case T_FLOAT:     return 4; 
     199  case T_RATIONAL: 
     200  case T_SRATIONAL: 
     201  case T_DOUBLE:    return 8; 
     202  default:          return 0; 
     203 } 
     204} 
     205 
     206struct {struct dir_entry* entry; int count;} IFD_LIST[]={{IFD0,0}, {IFD1,0}, {EXIF_IFD,0}, {GPS_IFD, 0}}; 
     207 
     208#define IFDs (sizeof(IFD_LIST)/sizeof(IFD_LIST[0])) 
     209 
     210#define TIFF_HDR_SIZE (8) 
     211 
     212char* dng_header_buf; 
     213int dng_header_buf_size; 
     214int dng_header_buf_offset; 
     215char *thumbnail_buf; 
     216 
     217void add_to_buf(void* var, int size) 
     218{ 
     219 memcpy(dng_header_buf+dng_header_buf_offset,var,size); 
     220 dng_header_buf_offset+=size; 
     221} 
     222 
    235223void create_dng_header(){ 
    236224 int var; 
     
    240228 
    241229 // filling EXIF fields 
    242    
    243 #if defined(OPT_GPS) 
    244 typedef struct { 
    245     int latitudeRef; 
    246     int latitude[6]; 
    247     int longitudeRef; 
    248     int longitude[6]; 
    249     int heightRef; 
    250     int height[2]; 
    251     int timeStamp[6]; 
    252     short status; 
    253     char mapDatum[7]; 
    254     char dateStamp[11]; 
    255     char unknown2[260]; 
    256 } tGPS; 
    257 tGPS gps; 
    258  
    259 get_property_case(PROPCASE_GPS, &gps, sizeof(tGPS)); 
    260 #endif 
     230 
     231 if (camera_info.has_gps) 
     232    get_property_case(PROPCASE_GPS, &gps_data, sizeof(tGPS)); 
     233 else 
     234     memset(&gps_data, 0, sizeof(tGPS)); 
    261235 
    262236 for (j=0;j<IFDs;j++) { 
     
    267241     case 0xC614: IFD_LIST[j].entry[i].count = strlen((char*)IFD_LIST[j].entry[i].offset) + 1; break;   // UniqueCameraModel 
    268242     case 0x132 : 
    269      case 0x8827: IFD_LIST[j].entry[i].offset=exif_data.iso; break;//ISOSpeedRatings 
    270243     case 0x8822: IFD_LIST[j].entry[i].offset=get_exp_program_for_exif(exif_data.exp_program); break;//ExposureProgram 
    271      case 0xA405: IFD_LIST[j].entry[i].offset=exif_data.effective_focal_length/1000; break; ////FocalLengthIn35mmFilm 
    272244     case 0x0112: IFD_LIST[j].entry[i].offset=get_orientation_for_exif(exif_data.orientation); break; //Orientation 
    273245     case 0x9209: IFD_LIST[j].entry[i].offset=get_flash_mode_for_exif(exif_data.flash_mode, exif_data.flash_fired); break; //Flash mode 
    274246     case 0x9207: IFD_LIST[j].entry[i].offset=get_metering_mode_for_exif(exif_data.metering_mode); break; // Metering mode 
    275 #if defined(OPT_GPS) 
    276      case 0x0001: IFD_LIST[j].entry[i].offset=gps.latitudeRef; break; 
    277      case 0x0002: IFD_LIST[j].entry[i].offset=(int)&(gps.latitude); break; 
    278      case 0x0003: IFD_LIST[j].entry[i].offset=gps.longitudeRef; break; 
    279      case 0x0004: IFD_LIST[j].entry[i].offset=(int)&(gps.longitude); break; 
    280      case 0x0005: IFD_LIST[j].entry[i].offset=gps.heightRef; break; 
    281      case 0x0006: IFD_LIST[j].entry[i].offset=(int)&(gps.height); break; 
    282      case 0x0007: IFD_LIST[j].entry[i].offset=(int)&(gps.timeStamp); break; 
    283      case 0x0009: IFD_LIST[j].entry[i].offset=(int)gps.status; break; 
    284      case 0x0012: IFD_LIST[j].entry[i].offset=(int)&(gps.mapDatum); break; 
    285      case 0x001D: IFD_LIST[j].entry[i].offset=(int)&(gps.dateStamp); break; 
    286 #endif 
    287247    } 
    288248  } 
     
    329289  for(i=0; IFD_LIST[j].entry[i].tag; i++) { 
    330290   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 
    331 #if defined(OPT_GPS) 
    332291   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 
    333 #endif 
    334292   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 
    335293   if (IFD_LIST[j].entry[i].tag==0x111)  { 
     
    357315  add_to_buf(&var, sizeof(short)); 
    358316  for(i=0; IFD_LIST[j].entry[i].tag; i++) { 
    359    add_to_buf(&IFD_LIST[j].entry[i].tag, sizeof(short)); 
    360    add_to_buf(&IFD_LIST[j].entry[i].type, sizeof(short)); 
    361    add_to_buf(&IFD_LIST[j].entry[i].count, sizeof(int)); 
    362    size_ext=get_type_size(IFD_LIST[j].entry[i].type)*IFD_LIST[j].entry[i].count; 
    363    if (size_ext<=4) add_to_buf(&IFD_LIST[j].entry[i].offset, sizeof(int)); 
    364    else { 
    365     add_to_buf(&extra_offset, sizeof(int)); 
    366     extra_offset+=size_ext+(size_ext&1);     
    367    } 
     317    add_to_buf(&IFD_LIST[j].entry[i].tag, sizeof(short)); 
     318    unsigned short t = IFD_LIST[j].entry[i].type & 0xFF; 
     319    add_to_buf(&t, sizeof(short)); 
     320    add_to_buf(&IFD_LIST[j].entry[i].count, sizeof(int)); 
     321    size_ext=get_type_size(IFD_LIST[j].entry[i].type)*IFD_LIST[j].entry[i].count; 
     322    if (size_ext<=4)  
     323    { 
     324        if (IFD_LIST[j].entry[i].type & T_PTR) 
     325        { 
     326            add_to_buf((void*)IFD_LIST[j].entry[i].offset, sizeof(int)); 
     327        } 
     328        else 
     329        { 
     330            add_to_buf(&IFD_LIST[j].entry[i].offset, sizeof(int)); 
     331        } 
     332    } 
     333    else 
     334    { 
     335        add_to_buf(&extra_offset, sizeof(int)); 
     336        extra_offset+=size_ext+(size_ext&1);     
     337    } 
    368338  } 
    369339 var=0;  
     
    477447 
    478448 cam_focal_length[0] = get_focal_length(shooting_get_zoom()); 
    479  exif_data.effective_focal_length = get_effective_focal_length(shooting_get_zoom()); 
     449 exif_data.effective_focal_length = get_effective_focal_length(shooting_get_zoom()) / 1000; 
    480450 
    481451 get_property_case(PROPCASE_ORIENTATION_SENSOR, &exif_data.orientation, sizeof(exif_data.orientation)); 
     
    501471 struct utimbuf t; 
    502472 
    503  if (safe_stat(fn, &st) != 0 || st.st_size<=hook_raw_size())  return; 
     473 if (safe_stat(fn, &st) != 0 || st.st_size<=camera_info.raw_size)  return; 
    504474 buf=malloc(BUF_SIZE); 
    505475 if (buf){ 
     
    513483    raw=fopen(fn,"w+b"); 
    514484    if (raw){ 
    515      fseek(dng, st.st_size-hook_raw_size(), SEEK_SET); // SEEK_END is not working? 
    516      for (i=0; i<hook_raw_size()/BUF_SIZE; i++) { 
     485     fseek(dng, st.st_size-camera_info.raw_size, SEEK_SET); // SEEK_END is not working? 
     486     for (i=0; i<camera_info.raw_size/BUF_SIZE; i++) { 
    517487      fread(buf, 1, BUF_SIZE, dng); 
    518488      reverse_bytes_order((char*)buf, BUF_SIZE); 
    519489      fwrite(buf, 1, BUF_SIZE, raw); 
    520490     } 
    521      fread(buf, 1, hook_raw_size()%BUF_SIZE, dng); 
    522      reverse_bytes_order((char*)buf, hook_raw_size()%BUF_SIZE); 
    523      fwrite(buf, 1, hook_raw_size()%BUF_SIZE, raw); 
     491     fread(buf, 1, camera_info.raw_size%BUF_SIZE, dng); 
     492     reverse_bytes_order((char*)buf, camera_info.raw_size%BUF_SIZE); 
     493     fwrite(buf, 1, camera_info.raw_size%BUF_SIZE, raw); 
    524494     fclose(raw); 
    525495     t.actime = t.modtime = time(NULL); 
     
    542512    int i; 
    543513    if (gamma[255]) return; 
    544 #if defined(CAMERA_sx30) || defined(CAMERA_sx40hs) || defined(CAMERA_g12) || defined(CAMERA_ixus310_elph500hs) 
    545514    for (i=0; i<12; i++) gamma[i]=pow_calc_2(255, i, 255, 0.5, 1); 
    546515    for (i=12; i<64; i++) gamma[i]=pow_calc_2(255, i, 255, 0.4, 1); 
    547516    for (i=64; i<=255; i++) gamma[i]=pow_calc_2(255, i, 255, 0.25, 1); 
    548 #else 
    549     for (i=0; i<=255; i++) gamma[i]=pow_calc_2(255, i, 255, 0.5, 1); 
    550 #endif 
    551517} 
    552518 
    553519void create_thumbnail() { 
    554     register int i, j, x, y; 
     520    register int i, j, x, y, yadj; 
    555521    register char *buf = thumbnail_buf; 
     522    register int shift = camera_info.bits_per_pixel - 8; 
     523 
     524    // Two patterns are: 
     525    //    R G         G B 
     526    //    G B   and   R G 
     527    // for the second pattern yadj shifts the thumbnail row down one line 
     528    // essentially making the patterns the same 
     529    yadj = (camera_info.cfa_pattern == 0x01000201) ? 1 : 0; 
    556530 
    557531    for (i=0; i<DNG_TH_HEIGHT; i++) 
    558532        for (j=0; j<DNG_TH_WIDTH; j++) 
    559533        { 
    560             x = (CAM_ACTIVE_AREA_X1+((CAM_ACTIVE_AREA_X2-CAM_ACTIVE_AREA_X1)*j)/DNG_TH_WIDTH) & 0xFFFFFFFE; 
    561             y = (CAM_ACTIVE_AREA_Y1+((CAM_ACTIVE_AREA_Y2-CAM_ACTIVE_AREA_Y1)*i)/DNG_TH_HEIGHT) & 0xFFFFFFFE; 
    562  
    563 #if cam_CFAPattern==0x02010100    // Red  Green  Green  Blue 
    564             *buf++ = gamma[get_raw_pixel(x,y)>>(CAM_SENSOR_BITS_PER_PIXEL-8)];           // red pixel 
    565             *buf++ = gamma[6*(get_raw_pixel(x+1,y)>>(CAM_SENSOR_BITS_PER_PIXEL-8))/10];  // green pixel 
    566             *buf++ = gamma[get_raw_pixel(x+1,y+1)>>(CAM_SENSOR_BITS_PER_PIXEL-8)];       // blue pixel 
    567 #elif cam_CFAPattern==0x01000201 // Green  Blue  Red  Green 
    568             *buf++ = gamma[get_raw_pixel(x,y+1)>>(CAM_SENSOR_BITS_PER_PIXEL-8)];         // red pixel 
    569             *buf++ = gamma[6*(get_raw_pixel(x,y)>>(CAM_SENSOR_BITS_PER_PIXEL-8))/10];    // green pixel 
    570             *buf++ = gamma[get_raw_pixel(x+1,y)>>(CAM_SENSOR_BITS_PER_PIXEL-8)];         // blue pixel 
    571 #else  
    572     #error please define new pattern here 
    573 #endif 
     534            x = (camera_info.jpeg.x + (camera_info.jpeg.width * j) / DNG_TH_WIDTH) & 0xFFFFFFFE; 
     535            y = ((camera_info.jpeg.y + (camera_info.jpeg.height * i) / DNG_TH_HEIGHT) & 0xFFFFFFFE) + yadj; 
     536 
     537            *buf++ = gamma[get_raw_pixel(x,y)>>shift];           // red pixel 
     538            *buf++ = gamma[6*(get_raw_pixel(x+1,y)>>shift)/10];  // green pixel 
     539            *buf++ = gamma[get_raw_pixel(x+1,y+1)>>shift];       // blue pixel 
    574540        } 
    575541} 
     
    599565    } 
    600566    count = 0; 
    601 #ifdef DNG_VERT_RLE_BADPIXELS 
    602     for (c[0]=CAM_ACTIVE_AREA_X1; c[0]<CAM_ACTIVE_AREA_X2; c[0]++) 
     567    for (c[0]=camera_info.active_area.x1; c[0]<camera_info.active_area.x2; c[0]++) 
    603568    { 
    604         for (c[1]=CAM_ACTIVE_AREA_Y1; c[1]<CAM_ACTIVE_AREA_Y2; c[1]++) 
     569        for (c[1]=camera_info.active_area.y1; c[1]<camera_info.active_area.y2; c[1]++) 
    605570        { 
    606571            if (get_raw_pixel(c[0],c[1])==0) 
     
    615580        } 
    616581    } 
    617 #else 
    618     for (c[1]=CAM_ACTIVE_AREA_Y1; c[1]<CAM_ACTIVE_AREA_Y2; c[1]++)  
    619     { 
    620         for (c[0]=CAM_ACTIVE_AREA_X1; c[0]<CAM_ACTIVE_AREA_X2; c[0]++)  
    621         { 
    622             if (get_raw_pixel(c[0],c[1])==0)  
    623             { 
    624                 if (f) fwrite(c, 1, 4, f); 
    625                 count++; 
    626             } 
    627         } 
    628     } 
    629 #endif 
    630582    if (f) fclose(f); 
    631583    init_badpixel_bin_flag = count; 
     
    672624    int i; 
    673625    short* ptr=binary_list; 
    674 #ifdef DNG_VERT_RLE_BADPIXELS 
    675626    short y, cnt; 
    676627    for (i=0; i<binary_count; i++, ptr+=2) 
     
    682633                patch_bad_pixel(ptr[0], y); 
    683634    } 
    684 #else 
    685     for (i=0; i<binary_count; i++, ptr+=2) 
    686         if (get_raw_pixel(ptr[0], ptr[1])==0) 
    687             patch_bad_pixel(ptr[0], ptr[1]); 
    688 #endif 
    689635} 
    690636 
     
    773719 
    774720//------------------------------------------------------------------- 
    775 // Write DNG header and thumbnail to file 
    776  
    777 void write_dng_header(int fd) 
     721// Write DNG header, thumbnail and data to file 
     722 
     723void write_dng(int fd, char* rawadr, char* altrawadr, unsigned long uncachedbit)  
    778724{ 
     725        create_dng_header(); 
     726 
    779727    if (dng_header_buf) 
    780728    { 
     
    784732        write(fd, dng_header_buf, dng_header_buf_size); 
    785733        write(fd, thumbnail_buf, DNG_TH_WIDTH*DNG_TH_HEIGHT*3); 
    786     } 
    787 } 
    788  
    789 //------------------------------------------------------------------- 
    790 void write_dng(int fd, char* rawadr, char* altrawadr, unsigned long uncachedbit)  
    791 { 
    792         create_dng_header(); 
    793     write_dng_header(fd); 
    794  
    795     reverse_bytes_order2(rawadr, altrawadr, hook_raw_size()); 
    796  
    797     // Write alternate (inactive) buffer that we reversed the bytes into above (if only one buffer then it will be the active buffer instead) 
    798     write(fd, (char*)(((unsigned long)altrawadr)|uncachedbit), hook_raw_size()); 
    799  
    800     if (rawadr == altrawadr)    // If only one RAW buffer then we have to swap the bytes back 
    801         reverse_bytes_order2(rawadr, altrawadr, hook_raw_size()); 
    802  
    803     free_dng_header(); 
     734 
     735        reverse_bytes_order2(rawadr, altrawadr, camera_info.raw_size); 
     736 
     737        // Write alternate (inactive) buffer that we reversed the bytes into above (if only one buffer then it will be the active buffer instead) 
     738        write(fd, (char*)(((unsigned long)altrawadr)|uncachedbit), camera_info.raw_size); 
     739 
     740        if (rawadr == altrawadr)    // If only one RAW buffer then we have to swap the bytes back 
     741            reverse_bytes_order2(rawadr, altrawadr, camera_info.raw_size); 
     742 
     743        free_dng_header(); 
     744    } 
    804745} 
    805746 
     
    842783    return 0; 
    843784} 
    844  
    845  
    846 #else 
    847  
    848 /*********** NO DNG SUPPORTED BY CAMERA - EMPTY MODULE **********/ 
    849  
    850 #include "module_load.h" 
    851  
    852 int _module_loader( void** chdk_export_list ) 
    853 { 
    854         // error bind - DNG is not supported and module is empty 
    855         return 1; 
    856 } 
    857  
    858  
    859 //--------------------------------------------------------- 
    860 // PURPOSE: Finalize module operations (close allocs, etc) 
    861 // RETURN VALUE: 0-ok, 1-fail 
    862 //--------------------------------------------------------- 
    863 int _module_unloader() 
    864 { 
    865   return 0; 
    866 } 
    867  
    868  
    869 #endif //DNG_SUPPORT 
    870785 
    871786 
  • branches/reyalp-flt/core/edgeoverlay.c

    r1511 r1512  
    4848static void get_viewport_size() 
    4949{ 
    50     viewport_height = vid_get_viewport_height()-EDGE_HMARGIN*2; //don't trace bottom lines 
     50    viewport_height = vid_get_viewport_height()-camera_info.edge_hmargin*2; //don't trace bottom lines 
    5151    viewport_width = vid_get_viewport_width(); 
    5252    viewport_byte_width = vid_get_viewport_byte_width(); 
     
    290290    int conv1, conv2; 
    291291 
    292     const int y_min = viewport_yoffset + EDGE_HMARGIN+ slice   *slice_height; 
    293     const int y_max = viewport_yoffset + EDGE_HMARGIN+(slice+1)*slice_height; 
     292    const int y_min = viewport_yoffset + camera_info.edge_hmargin+ slice   *slice_height; 
     293    const int y_max = viewport_yoffset + camera_info.edge_hmargin+(slice+1)*slice_height; 
    294294    const int x_min = viewport_xoffset*3 + 6; 
    295295    const int x_max = (viewport_width + viewport_xoffset - 2) * 3; 
     
    387387            if (conv1 + conv2 > *conf_edge_overlay_thresh) 
    388388            { 
    389                 bv_set(edgebuf, (y-viewport_yoffset-EDGE_HMARGIN)*viewport_width + xdiv3, 1); 
     389                bv_set(edgebuf, (y-viewport_yoffset-camera_info.edge_hmargin)*viewport_width + xdiv3, 1); 
    390390            } 
    391391 
     
    417417            if (conv1 + conv2 > *conf_edge_overlay_thresh) 
    418418            { 
    419                 bv_set(edgebuf, (y-viewport_yoffset-EDGE_HMARGIN)*viewport_width + xdiv3+1, 1); 
     419                bv_set(edgebuf, (y-viewport_yoffset-camera_info.edge_hmargin)*viewport_width + xdiv3+1, 1); 
    420420            } 
    421421        }   // for x 
     
    493493 
    494494    const color cl = *conf_edge_overlay_color; 
    495     const int y_slice_min = viewport_yoffset+EDGE_HMARGIN+ slice   *slice_height; 
    496     const int y_slice_max = viewport_yoffset+EDGE_HMARGIN+(slice+1)*slice_height; 
    497     const int y_min = viewport_yoffset+EDGE_HMARGIN; 
    498     const int y_max = viewport_yoffset+EDGE_HMARGIN+viewport_height; 
     495    const int y_slice_min = viewport_yoffset+camera_info.edge_hmargin+ slice   *slice_height; 
     496    const int y_slice_max = viewport_yoffset+camera_info.edge_hmargin+(slice+1)*slice_height; 
     497    const int y_min = viewport_yoffset+camera_info.edge_hmargin; 
     498    const int y_max = viewport_yoffset+camera_info.edge_hmargin+viewport_height; 
    499499    const int x_min = viewport_xoffset+2; 
    500500    const int x_max = (viewport_width + viewport_xoffset - 2); 
  • branches/reyalp-flt/core/gui_4wins.c

    r1494 r1512  
    2222 
    2323#define BORDER           20 
    24 #define XBORDER          (CAM_TS_BUTTON_BORDER+BORDER) 
     24#define XBORDER          (camera_info.ts_button_border+BORDER) 
    2525#define RECT_SIZE        30 
    2626#define BORDER_TOP       RECT_SIZE 
     
    180180    w=l*FONT_WIDTH+10; 
    181181 
    182     x = (screen_width-CAM_TS_BUTTON_BORDER-w)>>1; y = ((screen_height)>>1); 
     182    x = (screen_width-camera_info.ts_button_border-w)>>1; y = ((screen_height)>>1); 
    183183    draw_filled_round_rect(x, y, x+w, y+FONT_HEIGHT+6, MAKE_COLOR(COLOR_RED, COLOR_RED)); 
    184184    draw_string(x+((w-strlen(text)*FONT_WIDTH)>>1), y+4, text, cl); 
     
    245245void draw_mode() 
    246246{ 
    247     int x = (CAM_TS_BUTTON_BORDER/FONT_WIDTH) + 30; 
     247    int x = (camera_info.ts_button_border/FONT_WIDTH) + 30; 
    248248        draw_txt_string(x, 4, "            ", TEXT_COLOR); 
    249249        if (mode_rival==1) 
     
    311311        draw_filled_rect(0, 0, screen_width, screen_height, BG_COLOR);          // draw backgraund 
    312312        draw_filled_rect(XBORDER, BORDER+BORDER_TOP, XBORDER+(7*RECT_SIZE), BORDER+(6*RECT_SIZE)+BORDER_TOP, FIELD_COLOR); 
    313         draw_filled_round_rect(CAM_TS_BUTTON_BORDER+240, 90, CAM_TS_BUTTON_BORDER+360-BORDER, 240-10, INFO_COLOR); 
    314     draw_txt_string((CAM_TS_BUTTON_BORDER/FONT_WIDTH)+12, 0, lang_str(LANG_MENU_GAMES_CONNECT4), TEXT_COLOR); 
    315     draw_line(CAM_TS_BUTTON_BORDER,15,CAM_TS_BUTTON_BORDER+360,15,COLOR_SPLASH_GREY); 
     313        draw_filled_round_rect(camera_info.ts_button_border+240, 90, camera_info.ts_button_border+360-BORDER, 240-10, INFO_COLOR); 
     314    draw_txt_string((camera_info.ts_button_border/FONT_WIDTH)+12, 0, lang_str(LANG_MENU_GAMES_CONNECT4), TEXT_COLOR); 
     315    draw_line(camera_info.ts_button_border,15,camera_info.ts_button_border+360,15,COLOR_SPLASH_GREY); 
    316316 
    317317        for(i=0;i<7;i++) 
     
    329329 
    330330        move_cursor(0); 
    331         draw_txt_string((CAM_TS_BUTTON_BORDER/FONT_WIDTH)+30, 3, lang_str(LANG_CONNECT4_RIVAL), TEXT_COLOR); 
     331        draw_txt_string((camera_info.ts_button_border/FONT_WIDTH)+30, 3, lang_str(LANG_CONNECT4_RIVAL), TEXT_COLOR); 
    332332    sprintf(str, "%d",count_win[0]); 
    333         draw_txt_string((screen_width-CAM_TS_BUTTON_BORDER)/FONT_WIDTH-2-10, screen_height/FONT_HEIGHT-9, str, MAKE_COLOR(INFO_COLOR, P1_COLOR)); 
     333        draw_txt_string((screen_width-camera_info.ts_button_border)/FONT_WIDTH-2-10, screen_height/FONT_HEIGHT-9, str, MAKE_COLOR(INFO_COLOR, P1_COLOR)); 
    334334    sprintf(str, ":"); 
    335         draw_txt_string((screen_width-CAM_TS_BUTTON_BORDER)/FONT_WIDTH-2-7, screen_height/FONT_HEIGHT-9, str, INFO_TEXT_COLOR); 
     335        draw_txt_string((screen_width-camera_info.ts_button_border)/FONT_WIDTH-2-7, screen_height/FONT_HEIGHT-9, str, INFO_TEXT_COLOR); 
    336336    sprintf(str, "%d",count_win[1]); 
    337         draw_txt_string((screen_width-CAM_TS_BUTTON_BORDER)/FONT_WIDTH-2-4, screen_height/FONT_HEIGHT-9, str, MAKE_COLOR(INFO_COLOR, P2_COLOR)); 
     337        draw_txt_string((screen_width-camera_info.ts_button_border)/FONT_WIDTH-2-4, screen_height/FONT_HEIGHT-9, str, MAKE_COLOR(INFO_COLOR, P2_COLOR)); 
    338338        draw_mode(); 
    339339        if(cur_player==2&&!mode_rival) set(); 
     
    370370  static char str[16]; 
    371371  sprintf(str, "%3d%%", get_batt_perc()); 
    372   draw_txt_string((screen_width-CAM_TS_BUTTON_BORDER)/FONT_WIDTH-2-13, screen_height/FONT_HEIGHT-2, str, INFO_TEXT_COLOR); 
    373   gui_osd_draw_clock(CAM_TS_BUTTON_BORDER+290,208,INFO_TEXT_COLOR); 
     372  draw_txt_string((screen_width-camera_info.ts_button_border)/FONT_WIDTH-2-13, screen_height/FONT_HEIGHT-2, str, INFO_TEXT_COLOR); 
     373  gui_osd_draw_clock(camera_info.ts_button_border+290,208,INFO_TEXT_COLOR); 
    374374} 
    375375 
  • branches/reyalp-flt/core/gui_calendar.c

    r1494 r1512  
    6969 
    7070    draw_filled_rect(0, 0, screen_width-1, screen_height-1, MAKE_COLOR(SCREEN_COLOR, SCREEN_COLOR)); 
    71     draw_txt_string((CAM_TS_BUTTON_BORDER/FONT_WIDTH)+1, 0, lang_str(LANG_CALENDAR_TODAY), MAKE_COLOR(SCREEN_COLOR, COLOR_WHITE)); 
     71    draw_txt_string((camera_info.ts_button_border/FONT_WIDTH)+1, 0, lang_str(LANG_CALENDAR_TODAY), MAKE_COLOR(SCREEN_COLOR, COLOR_WHITE)); 
    7272    draw_rect(cal_x-3, cal_y-3, cal_x+cal_w+2, cal_y+cal_h+2, CALENDAR_COLOR); 
    7373    draw_filled_rect(cal_x-1, cal_y-1, cal_x+cal_w, cal_y+FONT_HEIGHT+8, TITLE_COLOR); 
     
    139139    ttm = localtime(&t); 
    140140    sprintf(str, " %2u %s %04u  %2u:%02u:%02u   ", ttm->tm_mday, lang_str(months[ttm->tm_mon]), 1900+ttm->tm_year, ttm->tm_hour, ttm->tm_min, ttm->tm_sec); 
    141     draw_txt_string((CAM_TS_BUTTON_BORDER/FONT_WIDTH)+8, 0, str, MAKE_COLOR(SCREEN_COLOR, COLOR_WHITE)); 
     141    draw_txt_string((camera_info.ts_button_border/FONT_WIDTH)+8, 0, str, MAKE_COLOR(SCREEN_COLOR, COLOR_WHITE)); 
    142142 
    143143    if (need_redraw) { 
  • branches/reyalp-flt/core/gui_mastermind.c

    r1494 r1512  
    3535static void guess_box(int pos, color col) 
    3636{ 
    37         draw_filled_rect(CAM_TS_BUTTON_BORDER+100+(pos*10), BORDER+(2*curr_y*10)+2+2*curr_y, CAM_TS_BUTTON_BORDER+100+(pos*10)+6, BORDER+(2*curr_y*10)+8+2*curr_y , MAKE_COLOR(col,col)); 
     37        draw_filled_rect(camera_info.ts_button_border+100+(pos*10), BORDER+(2*curr_y*10)+2+2*curr_y, camera_info.ts_button_border+100+(pos*10)+6, BORDER+(2*curr_y*10)+8+2*curr_y , MAKE_COLOR(col,col)); 
    3838} 
    3939 
     
    8484                     curr_color[1]==curr_color[2] || curr_color[1]==curr_color[3] || curr_color[2]==curr_color[3]) 
    8585    { 
    86                 draw_string(CAM_TS_BUTTON_BORDER+167, 130, lang_str(LANG_MENU_GAMES_DCOLOR), TEXT_COLOR); 
     86                draw_string(camera_info.ts_button_border+167, 130, lang_str(LANG_MENU_GAMES_DCOLOR), TEXT_COLOR); 
    8787                return 0; 
    8888        } 
     
    117117        for (i=0;i<4;i++) 
    118118                for (j=0;j<8;j++) 
    119                         draw_filled_rect(CAM_TS_BUTTON_BORDER+BORDER+(2*i*10), BORDER+(2*j*10)+2*j, CAM_TS_BUTTON_BORDER+BORDER+(2*i*10)+10, BORDER+(2*j*10)+2*j+10 , COLOR_LIGHT_GRAY); 
    120  
    121         draw_filled_rect(CAM_TS_BUTTON_BORDER+10, BORDER+(2*j*10)+2*j, CAM_TS_BUTTON_BORDER+150,BORDER+(2*j*10)+2*j+1, MAKE_COLOR(BG_COLOR,COLOR_WHITE)); 
    122         draw_filled_rect(CAM_TS_BUTTON_BORDER+148, 10, CAM_TS_BUTTON_BORDER+149,230, MAKE_COLOR(BG_COLOR,COLOR_WHITE)); 
    123         draw_filled_rect(CAM_TS_BUTTON_BORDER+151, 10, CAM_TS_BUTTON_BORDER+152,230, MAKE_COLOR(BG_COLOR,COLOR_WHITE)); 
     119                        draw_filled_rect(camera_info.ts_button_border+BORDER+(2*i*10), BORDER+(2*j*10)+2*j, camera_info.ts_button_border+BORDER+(2*i*10)+10, BORDER+(2*j*10)+2*j+10 , COLOR_LIGHT_GRAY); 
     120 
     121        draw_filled_rect(camera_info.ts_button_border+10, BORDER+(2*j*10)+2*j, camera_info.ts_button_border+150,BORDER+(2*j*10)+2*j+1, MAKE_COLOR(BG_COLOR,COLOR_WHITE)); 
     122        draw_filled_rect(camera_info.ts_button_border+148, 10, camera_info.ts_button_border+149,230, MAKE_COLOR(BG_COLOR,COLOR_WHITE)); 
     123        draw_filled_rect(camera_info.ts_button_border+151, 10, camera_info.ts_button_border+152,230, MAKE_COLOR(BG_COLOR,COLOR_WHITE)); 
    124124         
    125125        for (i=0; i<6;i++) 
    126                 draw_filled_rect(CAM_TS_BUTTON_BORDER+BORDER+(2*(i+7)*10)+20, 40, CAM_TS_BUTTON_BORDER+BORDER+(2*(i+7)*10)+35,55, MAKE_COLOR(colors[i],colors[i])); 
     126                draw_filled_rect(camera_info.ts_button_border+BORDER+(2*(i+7)*10)+20, 40, camera_info.ts_button_border+BORDER+(2*(i+7)*10)+35,55, MAKE_COLOR(colors[i],colors[i])); 
    127127                 
    128         draw_filled_rect(CAM_TS_BUTTON_BORDER+BORDER+(2*7*10)+20, 65, CAM_TS_BUTTON_BORDER+BORDER+(2*7*10)+35,80, MAKE_COLOR(COLOR_BLACK,COLOR_BLACK)); 
    129         draw_string(CAM_TS_BUTTON_BORDER+BORDER+(2*7*10)+50, 65 , lang_str(LANG_MENU_GAMES_RIGHT_PLACE), TEXT_COLOR); 
    130          
    131         draw_filled_rect(CAM_TS_BUTTON_BORDER+BORDER+(2*7*10)+20, 90, CAM_TS_BUTTON_BORDER+BORDER+(2*7*10)+35,105, MAKE_COLOR(COLOR_WHITE,COLOR_WHITE)); 
    132         draw_string(CAM_TS_BUTTON_BORDER+BORDER+(2*7*10)+50, 90 , lang_str(LANG_MENU_GAMES_C_IN_ANSWER), TEXT_COLOR); 
     128        draw_filled_rect(camera_info.ts_button_border+BORDER+(2*7*10)+20, 65, camera_info.ts_button_border+BORDER+(2*7*10)+35,80, MAKE_COLOR(COLOR_BLACK,COLOR_BLACK)); 
     129        draw_string(camera_info.ts_button_border+BORDER+(2*7*10)+50, 65 , lang_str(LANG_MENU_GAMES_RIGHT_PLACE), TEXT_COLOR); 
     130         
     131        draw_filled_rect(camera_info.ts_button_border+BORDER+(2*7*10)+20, 90, camera_info.ts_button_border+BORDER+(2*7*10)+35,105, MAKE_COLOR(COLOR_WHITE,COLOR_WHITE)); 
     132        draw_string(camera_info.ts_button_border+BORDER+(2*7*10)+50, 90 , lang_str(LANG_MENU_GAMES_C_IN_ANSWER), TEXT_COLOR); 
    133133                                         
    134         draw_string(CAM_TS_BUTTON_BORDER+173, 20 , lang_str(LANG_MENU_GAMES_AC_COLORS), TEXT_COLOR); 
     134        draw_string(camera_info.ts_button_border+173, 20 , lang_str(LANG_MENU_GAMES_AC_COLORS), TEXT_COLOR); 
    135135                 
    136         draw_string(CAM_TS_BUTTON_BORDER+167, 200 , lang_str(LANG_MENU_GAMES_CURSOR1), TEXT_COLOR); 
    137         draw_string(CAM_TS_BUTTON_BORDER+167, 185 , lang_str(LANG_MENU_GAMES_CURSOR2), TEXT_COLOR); 
    138         draw_string(CAM_TS_BUTTON_BORDER+167, 170 , lang_str(LANG_MENU_GAMES_CURSOR3), TEXT_COLOR); 
     136        draw_string(camera_info.ts_button_border+167, 200 , lang_str(LANG_MENU_GAMES_CURSOR1), TEXT_COLOR); 
     137        draw_string(camera_info.ts_button_border+167, 185 , lang_str(LANG_MENU_GAMES_CURSOR2), TEXT_COLOR); 
     138        draw_string(camera_info.ts_button_border+167, 170 , lang_str(LANG_MENU_GAMES_CURSOR3), TEXT_COLOR); 
    139139 
    140140        for(i=0;i<4;i++) curr_color[i]=99; 
     
    148148{ 
    149149    if (curr_color[curr_x] == 99) curr_color[curr_x] = 0; 
    150     draw_filled_rect(CAM_TS_BUTTON_BORDER+BORDER+(2*curr_x*10), BORDER+(2*curr_y*10)+2*curr_y, CAM_TS_BUTTON_BORDER+BORDER+(2*curr_x*10)+10, BORDER+(2*curr_y*10)+2*curr_y+10 , MAKE_COLOR(colors[curr_color[curr_x]],border)); 
     150    draw_filled_rect(camera_info.ts_button_border+BORDER+(2*curr_x*10), BORDER+(2*curr_y*10)+2*curr_y, camera_info.ts_button_border+BORDER+(2*curr_x*10)+10, BORDER+(2*curr_y*10)+2*curr_y+10 , MAKE_COLOR(colors[curr_color[curr_x]],border)); 
    151151} 
    152152 
     
    154154{ 
    155155    int i; 
    156     draw_string(CAM_TS_BUTTON_BORDER+198, 130 , lang_str(msg), TEXT_COLOR); 
     156    draw_string(camera_info.ts_button_border+198, 130 , lang_str(msg), TEXT_COLOR); 
    157157        for (i=0; i<4;i++) 
    158             draw_filled_rect(CAM_TS_BUTTON_BORDER+BORDER+(2*i*10), 213, CAM_TS_BUTTON_BORDER+BORDER+(2*i*10)+10,223,  MAKE_COLOR(colors[answer[i]],colors[answer[i]])); 
     158            draw_filled_rect(camera_info.ts_button_border+BORDER+(2*i*10), 213, camera_info.ts_button_border+BORDER+(2*i*10)+10,223,  MAKE_COLOR(colors[answer[i]],colors[answer[i]])); 
    159159} 
    160160 
     
    178178        if (GameGo == 1) 
    179179        { 
    180             draw_string(CAM_TS_BUTTON_BORDER+167, 130 , "                       ", TEXT_COLOR); 
     180            draw_string(camera_info.ts_button_border+167, 130 , "                       ", TEXT_COLOR); 
    181181                switch (kbd_get_autoclicked_key())  
    182182                { 
     
    230230    static struct tm *ttm; 
    231231 
    232     draw_txt_string(CAM_TS_BUTTON_BORDER/FONT_WIDTH+15, 0, lang_str(LANG_MENU_GAMES_MASTERMIND), MAKE_COLOR(BG_COLOR, COLOR_WHITE)); 
     232    draw_txt_string(camera_info.ts_button_border/FONT_WIDTH+15, 0, lang_str(LANG_MENU_GAMES_MASTERMIND), MAKE_COLOR(BG_COLOR, COLOR_WHITE)); 
    233233 
    234234    t = time(NULL); 
    235235    ttm = localtime(&t); 
    236236    sprintf(buf, "Time: %2u:%02u  Batt:%3d%%", ttm->tm_hour, ttm->tm_min, get_batt_perc()); 
    237     draw_txt_string((screen_width-CAM_TS_BUTTON_BORDER)/FONT_WIDTH-2-1-1-9-2-5-4, screen_height/FONT_HEIGHT-1, buf, TEXT_COLOR); 
     237    draw_txt_string((screen_width-camera_info.ts_button_border)/FONT_WIDTH-2-1-1-9-2-5-4, screen_height/FONT_HEIGHT-1, buf, TEXT_COLOR); 
    238238} 
    239239 
  • branches/reyalp-flt/core/gui_osd.c

    r1511 r1512  
    11541154    if ((conf.autoiso_enable && shooting_get_iso_mode()<=0 && !(m==MODE_M || m==MODE_TV) && shooting_get_flash_mode() && (!(conf.override_disable==1 && conf.override_disable_all))) || gui_mode==GUI_MODE_OSD)   
    11551155            gui_print_osd_state_string_chr("AUTOISO:", ((conf.autoiso_enable==1)?"ON":"OFF")); 
    1156     if ((conf.subj_dist_override_value && conf.subj_dist_override_koef && shooting_can_focus() && !(conf.override_disable==1)) || ((gui_mode==GUI_MODE_ALT) && shooting_get_common_focus_mode())        || gui_mode==GUI_MODE_OSD)   { 
     1156    if ((conf.subj_dist_override_value && conf.subj_dist_override_koef && shooting_can_focus() && !(conf.override_disable==1)) || ((gui_get_mode()==GUI_MODE_ALT) && shooting_get_common_focus_mode())  || gui_mode==GUI_MODE_OSD)   { 
    11571157        gui_print_osd_state_string_int("SD:",shooting_get_subject_distance_override_value()); 
    11581158        if (gui_mode==GUI_MODE_ALT)   
  • branches/reyalp-flt/core/gui_palette.c

    r1489 r1512  
    7979    static char buf[64]; 
    8080 
    81     xl = CAM_TS_BUTTON_BORDER; 
    82     xr = screen_width - CAM_TS_BUTTON_BORDER; 
     81    xl = camera_info.ts_button_border; 
     82    xr = screen_width - camera_info.ts_button_border; 
    8383 
    8484    if (gui_palette_redraw) 
  • branches/reyalp-flt/core/gui_read.c

    r1494 r1512  
    4444static void gui_read_draw_batt() { 
    4545    sprintf(buffer, "Batt:%3d%%", get_batt_perc()); 
    46     draw_txt_string((screen_width-CAM_TS_BUTTON_BORDER)/FONT_WIDTH-2-1-1-9, 0, buffer, MAKE_COLOR(COLOR_BLACK, COLOR_WHITE)); 
     46    draw_txt_string((screen_width-camera_info.ts_button_border)/FONT_WIDTH-2-1-1-9, 0, buffer, MAKE_COLOR(COLOR_BLACK, COLOR_WHITE)); 
    4747} 
    4848 
     
    5555    ttm = localtime(&t); 
    5656    sprintf(buffer, "%2u:%02u", ttm->tm_hour, ttm->tm_min); 
    57     draw_txt_string((screen_width-CAM_TS_BUTTON_BORDER)/FONT_WIDTH-2-1-1-9-2-5, 0, buffer, MAKE_COLOR(COLOR_BLACK, COLOR_WHITE)); 
     57    draw_txt_string((screen_width-camera_info.ts_button_border)/FONT_WIDTH-2-1-1-9-2-5, 0, buffer, MAKE_COLOR(COLOR_BLACK, COLOR_WHITE)); 
    5858} 
    5959 
    6060//------------------------------------------------------------------- 
    6161static void gui_read_draw_scroll_indicator() { 
    62     draw_txt_char((screen_width-CAM_TS_BUTTON_BORDER)/FONT_WIDTH-2, 0, (*conf_reader_autoscroll)?((pause)?'\x05':'\x04'):'\x03', MAKE_COLOR(COLOR_BLACK, COLOR_WHITE)); //title infoline 
     62    draw_txt_char((screen_width-camera_info.ts_button_border)/FONT_WIDTH-2, 0, (*conf_reader_autoscroll)?((pause)?'\x05':'\x04'):'\x03', MAKE_COLOR(COLOR_BLACK, COLOR_WHITE)); //title infoline 
    6363} 
    6464 
     
    7878    pause = 0; 
    7979    read_to_draw = 1; 
    80     x=CAM_TS_BUTTON_BORDER+6;  
     80    x=camera_info.ts_button_border+6;  
    8181    y=FONT_HEIGHT; 
    82     w=screen_width-CAM_TS_BUTTON_BORDER*2-6-6-8; 
     82    w=screen_width-camera_info.ts_button_border*2-6-6-8; 
    8383    h=screen_height-y; 
    8484    last_time = get_tick_count(); 
     
    188188        sprintf(buffer, "(%3d%%) %d/%d  ", (read_file_size)?(*conf_reader_pos*100/read_file_size):0, *conf_reader_pos, read_file_size); 
    189189        buffer[screen_width/FONT_WIDTH]=0; 
    190         draw_txt_string((CAM_TS_BUTTON_BORDER/FONT_WIDTH), 0, buffer, MAKE_COLOR(COLOR_BLACK, COLOR_WHITE)); //title infoline 
     190        draw_txt_string((camera_info.ts_button_border/FONT_WIDTH), 0, buffer, MAKE_COLOR(COLOR_BLACK, COLOR_WHITE)); //title infoline 
    191191 
    192192        // scrollbar 
  • branches/reyalp-flt/core/gui_reversi.c

    r1494 r1512  
    227227 
    228228    field_size = (screen_height-2*FONT_HEIGHT-4)&0xFFF8; 
    229     field_x = CAM_TS_BUTTON_BORDER+FONT_WIDTH+8; 
     229    field_x = camera_info.ts_button_border+FONT_WIDTH+8; 
    230230    field_y = (screen_height-field_size)>>1; 
    231231    cell_size = field_size >> 3; 
     
    329329//------------------------------------------------------------------- 
    330330static void redrawstatus() { 
    331     int x=CAM_TS_BUTTON_BORDER+field_size+FONT_WIDTH*2+23, y = 25; 
     331    int x=camera_info.ts_button_border+field_size+FONT_WIDTH*2+23, y = 25; 
    332332    if (InGame) {  
    333333        if (CurrPlayer==FIELD_PLAYER1) {  
     
    410410 
    411411    sprintf(buf, "Batt:%3d%%", get_batt_perc()); 
    412     draw_txt_string((screen_width-CAM_TS_BUTTON_BORDER)/FONT_WIDTH-2-9, screen_height/FONT_HEIGHT-1, buf, MAKE_COLOR(SCREEN_COLOR, COLOR_WHITE)); 
     412    draw_txt_string((screen_width-camera_info.ts_button_border)/FONT_WIDTH-2-9, screen_height/FONT_HEIGHT-1, buf, MAKE_COLOR(SCREEN_COLOR, COLOR_WHITE)); 
    413413 
    414414    Timer(); 
  • branches/reyalp-flt/core/gui_sokoban.c

    r1494 r1512  
    259259//------------------------------------------------------------------- 
    260260static void sokoban_draw_box(int x, int y, color cl) { 
    261     draw_filled_rect(CAM_TS_BUTTON_BORDER+x*cell_size, y*cell_size, CAM_TS_BUTTON_BORDER+x*cell_size+cell_size-1, y*cell_size+cell_size-1, cl); 
    262     draw_line(CAM_TS_BUTTON_BORDER+x*cell_size+2, y*cell_size, CAM_TS_BUTTON_BORDER+x*cell_size+2, y*cell_size+cell_size-1, cl); 
    263     draw_line(CAM_TS_BUTTON_BORDER+x*cell_size+cell_size-1-2, y*cell_size, CAM_TS_BUTTON_BORDER+x*cell_size+cell_size-1-2, y*cell_size+cell_size-1, cl); 
    264     draw_line(CAM_TS_BUTTON_BORDER+x*cell_size+2, y*cell_size+2, CAM_TS_BUTTON_BORDER+x*cell_size+cell_size-1-2, y*cell_size+2, cl); 
    265     draw_line(CAM_TS_BUTTON_BORDER+x*cell_size+2, y*cell_size+cell_size-1-2, CAM_TS_BUTTON_BORDER+x*cell_size+cell_size-1-2, y*cell_size+cell_size-1-2, cl); 
     261    draw_filled_rect(camera_info.ts_button_border+x*cell_size, y*cell_size, camera_info.ts_button_border+x*cell_size+cell_size-1, y*cell_size+cell_size-1, cl); 
     262    draw_line(camera_info.ts_button_border+x*cell_size+2, y*cell_size, camera_info.ts_button_border+x*cell_size+2, y*cell_size+cell_size-1, cl); 
     263    draw_line(camera_info.ts_button_border+x*cell_size+cell_size-1-2, y*cell_size, camera_info.ts_button_border+x*cell_size+cell_size-1-2, y*cell_size+cell_size-1, cl); 
     264    draw_line(camera_info.ts_button_border+x*cell_size+2, y*cell_size+2, camera_info.ts_button_border+x*cell_size+cell_size-1-2, y*cell_size+2, cl); 
     265    draw_line(camera_info.ts_button_border+x*cell_size+2, y*cell_size+cell_size-1-2, camera_info.ts_button_border+x*cell_size+cell_size-1-2, y*cell_size+cell_size-1-2, cl); 
    266266} 
    267267 
     
    394394                switch (field[y][x]) { 
    395395                    case MARKER_WALL: 
    396                         draw_filled_rect(CAM_TS_BUTTON_BORDER+x*cell_size, y*cell_size, CAM_TS_BUTTON_BORDER+x*cell_size+cell_size-1, y*cell_size+cell_size-1, MAKE_COLOR(WALL_COLOR_1, WALL_COLOR_2)); 
     396                        draw_filled_rect(camera_info.ts_button_border+x*cell_size, y*cell_size, camera_info.ts_button_border+x*cell_size+cell_size-1, y*cell_size+cell_size-1, MAKE_COLOR(WALL_COLOR_1, WALL_COLOR_2)); 
    397397                        break; 
    398398                    case MARKER_BOX: 
     
    400400                        break; 
    401401                    case MARKER_PLACE: 
    402                         draw_filled_rect(CAM_TS_BUTTON_BORDER+x*cell_size, y*cell_size, CAM_TS_BUTTON_BORDER+x*cell_size+cell_size-1, y*cell_size+cell_size-1, MAKE_COLOR(SCREEN_COLOR, SCREEN_COLOR)); 
    403                         draw_filled_rect(CAM_TS_BUTTON_BORDER+x*cell_size+4, y*cell_size+4, CAM_TS_BUTTON_BORDER+x*cell_size+cell_size-1-4, y*cell_size+cell_size-1-4, MAKE_COLOR(PLACE_COLOR_1, PLACE_COLOR_2)); 
     402                        draw_filled_rect(camera_info.ts_button_border+x*cell_size, y*cell_size, camera_info.ts_button_border+x*cell_size+cell_size-1, y*cell_size+cell_size-1, MAKE_COLOR(SCREEN_COLOR, SCREEN_COLOR)); 
     403                        draw_filled_rect(camera_info.ts_button_border+x*cell_size+4, y*cell_size+4, camera_info.ts_button_border+x*cell_size+cell_size-1-4, y*cell_size+cell_size-1-4, MAKE_COLOR(PLACE_COLOR_1, PLACE_COLOR_2)); 
    404404                        break; 
    405405                    case MARKER_BOX_PLACE: 
     
    408408                    case MARKER_PLAYER: 
    409409                    case MARKER_PLAYER_PLACE: 
    410                         draw_filled_rect(CAM_TS_BUTTON_BORDER+x*cell_size, y*cell_size, CAM_TS_BUTTON_BORDER+x*cell_size+cell_size-1, y*cell_size+cell_size-1, MAKE_COLOR(SCREEN_COLOR, SCREEN_COLOR)); 
    411                         draw_filled_ellipse(CAM_TS_BUTTON_BORDER+x*cell_size+(cell_size>>1)-1, y*cell_size+(cell_size>>1)-1, (cell_size>>1)-3, (cell_size>>1)-3, MAKE_COLOR(PLAYER_COLOR_1, PLAYER_COLOR_2)); 
     410                        draw_filled_rect(camera_info.ts_button_border+x*cell_size, y*cell_size, camera_info.ts_button_border+x*cell_size+cell_size-1, y*cell_size+cell_size-1, MAKE_COLOR(SCREEN_COLOR, SCREEN_COLOR)); 
     411                        draw_filled_ellipse(camera_info.ts_button_border+x*cell_size+(cell_size>>1)-1, y*cell_size+(cell_size>>1)-1, (cell_size>>1)-3, (cell_size>>1)-3, MAKE_COLOR(PLAYER_COLOR_1, PLAYER_COLOR_2)); 
    412412                        break; 
    413413                    case MARKER_EMPTY: 
    414414                    default: 
    415                         draw_filled_rect(CAM_TS_BUTTON_BORDER+x*cell_size, y*cell_size, CAM_TS_BUTTON_BORDER+x*cell_size+cell_size-1, y*cell_size+cell_size-1, MAKE_COLOR(SCREEN_COLOR, SCREEN_COLOR)); 
     415                        draw_filled_rect(camera_info.ts_button_border+x*cell_size, y*cell_size, camera_info.ts_button_border+x*cell_size+cell_size-1, y*cell_size+cell_size-1, MAKE_COLOR(SCREEN_COLOR, SCREEN_COLOR)); 
    416416                        break; 
    417417                } 
     
    419419        } 
    420420 
    421         draw_line(CAM_TS_BUTTON_BORDER+cell_size*FIELD_WIDTH, 0, CAM_TS_BUTTON_BORDER+cell_size*FIELD_WIDTH, screen_height-1, COLOR_WHITE); 
    422         draw_line(CAM_TS_BUTTON_BORDER+cell_size*FIELD_WIDTH+1, 0, CAM_TS_BUTTON_BORDER+cell_size*FIELD_WIDTH+1, screen_height-1, COLOR_BLACK); 
     421        draw_line(camera_info.ts_button_border+cell_size*FIELD_WIDTH, 0, camera_info.ts_button_border+cell_size*FIELD_WIDTH, screen_height-1, COLOR_WHITE); 
     422        draw_line(camera_info.ts_button_border+cell_size*FIELD_WIDTH+1, 0, camera_info.ts_button_border+cell_size*FIELD_WIDTH+1, screen_height-1, COLOR_BLACK); 
    423423 
    424424        sprintf(str, "%s: %-6d", lang_str(LANG_SOKOBAN_TEXT_LEVEL), *conf_sokoban_level+1); 
    425         draw_string(CAM_TS_BUTTON_BORDER+cell_size*FIELD_WIDTH+2, 8, str, MAKE_COLOR(SCREEN_COLOR, COLOR_WHITE)); 
     425        draw_string(camera_info.ts_button_border+cell_size*FIELD_WIDTH+2, 8, str, MAKE_COLOR(SCREEN_COLOR, COLOR_WHITE)); 
    426426        sprintf(str, "%s: %-6d", lang_str(LANG_SOKOBAN_TEXT_MOVES), moves); 
    427         draw_string(CAM_TS_BUTTON_BORDER+cell_size*FIELD_WIDTH+2, 8+FONT_HEIGHT, str, MAKE_COLOR(SCREEN_COLOR, COLOR_WHITE)); 
     427        draw_string(camera_info.ts_button_border+cell_size*FIELD_WIDTH+2, 8+FONT_HEIGHT, str, MAKE_COLOR(SCREEN_COLOR, COLOR_WHITE)); 
    428428 
    429429        //draw_filled_rect(cell_size*FIELD_WIDTH+2, 8+FONT_HEIGHT*2, screen_width-1, screen_height-1, MAKE_COLOR(SCREEN_COLOR, SCREEN_COLOR)); 
     
    436436 
    437437    sprintf(str, "Batt:%3d%%", get_batt_perc()); 
    438     draw_txt_string((screen_width-CAM_TS_BUTTON_BORDER)/FONT_WIDTH-2-9, screen_height/FONT_HEIGHT-1, str, MAKE_COLOR(SCREEN_COLOR, COLOR_WHITE)); 
     438    draw_txt_string((screen_width-camera_info.ts_button_border)/FONT_WIDTH-2-9, screen_height/FONT_HEIGHT-1, str, MAKE_COLOR(SCREEN_COLOR, COLOR_WHITE)); 
    439439} 
    440440 
  • branches/reyalp-flt/core/gui_tetris.c

    r1494 r1512  
    158158            for (j = 0; j < 4; ++j) { 
    159159                if (game->nextBlock.cells[i][j] != EMPTY_CELL) { 
    160                     draw_filled_rect(CAM_TS_BUTTON_BORDER+PREVIEW_X + (TILE_SIZE * i), 
     160                    draw_filled_rect(camera_info.ts_button_border+PREVIEW_X + (TILE_SIZE * i), 
    161161                            PREVIEW_Y + (TILE_SIZE * j), 
    162                             CAM_TS_BUTTON_BORDER+PREVIEW_X + (TILE_SIZE * i)+TILE_SIZE-1, 
     162                            camera_info.ts_button_border+PREVIEW_X + (TILE_SIZE * i)+TILE_SIZE-1, 
    163163                            PREVIEW_Y + (TILE_SIZE * j)+TILE_SIZE-1, 
    164164                             MAKE_COLOR(game->nextBlock.cells[i][j], game->nextBlock.cells[i][j])); 
    165165                }else{ 
    166                     draw_filled_rect(CAM_TS_BUTTON_BORDER+PREVIEW_X + (TILE_SIZE * i), 
     166                    draw_filled_rect(camera_info.ts_button_border+PREVIEW_X + (TILE_SIZE * i), 
    167167                            PREVIEW_Y + (TILE_SIZE * j), 
    168                             CAM_TS_BUTTON_BORDER+PREVIEW_X + (TILE_SIZE * i)+TILE_SIZE-1, 
     168                            camera_info.ts_button_border+PREVIEW_X + (TILE_SIZE * i)+TILE_SIZE-1, 
    169169                            PREVIEW_Y + (TILE_SIZE * j)+TILE_SIZE-1, 
    170170                            TETRIS_COLOR_BG); 
     
    194194        for (j = 0; j < BOARD_HEIGHT; ++j){ 
    195195                    if(tmp[i][j] != EMPTY_CELL){ 
    196                     draw_filled_rect(CAM_TS_BUTTON_BORDER+BOARD_X + (TILE_SIZE * i), 
     196                    draw_filled_rect(camera_info.ts_button_border+BOARD_X + (TILE_SIZE * i), 
    197197                            BOARD_Y + (TILE_SIZE * j), 
    198                             CAM_TS_BUTTON_BORDER+BOARD_X + (TILE_SIZE * i)+TILE_SIZE-1, 
     198                            camera_info.ts_button_border+BOARD_X + (TILE_SIZE * i)+TILE_SIZE-1, 
    199199                            BOARD_Y + (TILE_SIZE * j)+TILE_SIZE-1, 
    200200                             MAKE_COLOR(tmp[i][j], tmp[i][j])); 
    201201                    }else if(tmp2[i][j] != EMPTY_CELL){ 
    202                     draw_filled_rect(CAM_TS_BUTTON_BORDER+BOARD_X + (TILE_SIZE * i), 
     202                    draw_filled_rect(camera_info.ts_button_border+BOARD_X + (TILE_SIZE * i), 
    203203                            BOARD_Y + (TILE_SIZE * j), 
    204                             CAM_TS_BUTTON_BORDER+BOARD_X + (TILE_SIZE * i)+TILE_SIZE-1, 
     204                            camera_info.ts_button_border+BOARD_X + (TILE_SIZE * i)+TILE_SIZE-1, 
    205205                            BOARD_Y + (TILE_SIZE * j)+TILE_SIZE-1, 
    206206                             MAKE_COLOR(tmp2[i][j], tmp2[i][j])); 
    207207                    }else{ 
    208                     draw_filled_rect(CAM_TS_BUTTON_BORDER+BOARD_X + (TILE_SIZE * i), 
     208                    draw_filled_rect(camera_info.ts_button_border+BOARD_X + (TILE_SIZE * i), 
    209209                            BOARD_Y + (TILE_SIZE * j), 
    210                             CAM_TS_BUTTON_BORDER+BOARD_X + (TILE_SIZE * i)+TILE_SIZE-1, 
     210                            camera_info.ts_button_border+BOARD_X + (TILE_SIZE * i)+TILE_SIZE-1, 
    211211                            BOARD_Y + (TILE_SIZE * j)+TILE_SIZE-1, 
    212212                             TETRIS_COLOR_BOARD); 
     
    219219    static struct tm *ttm; 
    220220      sprintf(str_buf,"High:    %5d",game->stats.high); 
    221       draw_string(CAM_TS_BUTTON_BORDER+150,35,str_buf, MAKE_COLOR(TETRIS_COLOR_BG, COLOR_BLACK)); 
     221      draw_string(camera_info.ts_button_border+150,35,str_buf, MAKE_COLOR(TETRIS_COLOR_BG, COLOR_BLACK)); 
    222222      sprintf(str_buf,"Points:  %5d",game->stats.score); 
    223       draw_string(CAM_TS_BUTTON_BORDER+150,55,str_buf, MAKE_COLOR(TETRIS_COLOR_BG, COLOR_BLACK)); 
     223      draw_string(camera_info.ts_button_border+150,55,str_buf, MAKE_COLOR(TETRIS_COLOR_BG, COLOR_BLACK)); 
    224224      sprintf(str_buf,"Lines:   %5d",game->stats.lines); 
    225       draw_string(CAM_TS_BUTTON_BORDER+150,75,str_buf, MAKE_COLOR(TETRIS_COLOR_BG, COLOR_BLACK)); 
     225      draw_string(camera_info.ts_button_border+150,75,str_buf, MAKE_COLOR(TETRIS_COLOR_BG, COLOR_BLACK)); 
    226226      sprintf(str_buf,"Level:   %5d",game->stats.level); 
    227       draw_string(CAM_TS_BUTTON_BORDER+150,95,str_buf, MAKE_COLOR(TETRIS_COLOR_BG, COLOR_BLACK)); 
     227      draw_string(camera_info.ts_button_border+150,95,str_buf, MAKE_COLOR(TETRIS_COLOR_BG, COLOR_BLACK)); 
    228228     sprintf(str_buf,"UP  -> Pause"); 
    229      draw_string(CAM_TS_BUTTON_BORDER+150,135,str_buf, MAKE_COLOR(TETRIS_COLOR_BG, COLOR_BLACK)); 
     229     draw_string(camera_info.ts_button_border+150,135,str_buf, MAKE_COLOR(TETRIS_COLOR_BG, COLOR_BLACK)); 
    230230     sprintf(str_buf,"SET -> Rotate"); 
    231      draw_string(CAM_TS_BUTTON_BORDER+150,155,str_buf, MAKE_COLOR(TETRIS_COLOR_BG, COLOR_BLACK)); 
     231     draw_string(camera_info.ts_button_border+150,155,str_buf, MAKE_COLOR(TETRIS_COLOR_BG, COLOR_BLACK)); 
    232232     t = time(NULL); 
    233233      ttm = localtime(&t); 
    234234      sprintf(str_buf,"Time:    %2u:%02u", ttm->tm_hour, ttm->tm_min); 
    235      draw_string(CAM_TS_BUTTON_BORDER+150,195,str_buf, MAKE_COLOR(TETRIS_COLOR_BG, COLOR_BLACK)); 
     235     draw_string(camera_info.ts_button_border+150,195,str_buf, MAKE_COLOR(TETRIS_COLOR_BG, COLOR_BLACK)); 
    236236     sprintf(str_buf,"Batt:     %3d%%", get_batt_perc()); 
    237      draw_string(CAM_TS_BUTTON_BORDER+150,215,str_buf, MAKE_COLOR(TETRIS_COLOR_BG, COLOR_BLACK)); 
     237     draw_string(camera_info.ts_button_border+150,215,str_buf, MAKE_COLOR(TETRIS_COLOR_BG, COLOR_BLACK)); 
    238238} 
    239239 
     
    665665 
    666666void gui_tetris_init(){ 
    667     draw_filled_rect(CAM_TS_BUTTON_BORDER+0,0,screen_width-CAM_TS_BUTTON_BORDER,screen_height, TETRIS_COLOR_BG); 
    668     draw_rect(CAM_TS_BUTTON_BORDER+BOARD_X-1,BOARD_Y-1,CAM_TS_BUTTON_BORDER+BOARD_WIDTH*TILE_SIZE+10,BOARD_HEIGHT*TILE_SIZE+10, COLOR_BLACK); 
     667    draw_filled_rect(camera_info.ts_button_border+0,0,screen_width-camera_info.ts_button_border,screen_height, TETRIS_COLOR_BG); 
     668    draw_rect(camera_info.ts_button_border+BOARD_X-1,BOARD_Y-1,camera_info.ts_button_border+BOARD_WIDTH*TILE_SIZE+10,BOARD_HEIGHT*TILE_SIZE+10, COLOR_BLACK); 
    669669    game = createGame(); 
    670670    gameInit(game); 
  • branches/reyalp-flt/core/main.c

    r1511 r1512  
    1313#include "module_load.h" 
    1414#include "gui_draw.h" 
     15 
     16//========================================================== 
     17// Data Structure to store camera specific information 
     18// Used by modules to ensure module code is platform independent 
     19 
     20_cam_info camera_info = {  
     21    CAM_SENSOR_BITS_PER_PIXEL,  
     22    CAM_BLACK_LEVEL, CAM_WHITE_LEVEL, 
     23    CAM_RAW_ROWS, CAM_RAW_ROWPIX, (CAM_RAW_ROWPIX*CAM_SENSOR_BITS_PER_PIXEL)/8, CAM_RAW_ROWS * ((CAM_RAW_ROWPIX*CAM_SENSOR_BITS_PER_PIXEL)/8), 
     24    {{ 
     25        (CAM_ACTIVE_AREA_X2-CAM_ACTIVE_AREA_X1-CAM_JPEG_WIDTH)/2, (CAM_ACTIVE_AREA_Y2-CAM_ACTIVE_AREA_Y1-CAM_JPEG_HEIGHT)/2, 
     26        CAM_JPEG_WIDTH, CAM_JPEG_HEIGHT 
     27    }}, 
     28    { { CAM_ACTIVE_AREA_Y1, CAM_ACTIVE_AREA_X1, CAM_ACTIVE_AREA_Y2, CAM_ACTIVE_AREA_X2 } },  
     29#if defined(CAM_DNG_LENS_INFO) 
     30    CAM_DNG_LENS_INFO, 
     31#else 
     32    { 0, 0, 0, 0, 0, 0, 0, 0 }, 
     33#endif 
     34#if defined(CAM_DNG_EXPOSURE_BIAS) 
     35    { CAM_DNG_EXPOSURE_BIAS }, 
     36#else 
     37    { -1 , 2 }, 
     38#endif 
     39    { CAM_COLORMATRIX1 }, 
     40    cam_CFAPattern, cam_CalibrationIlluminant1, 
     41#if defined(OPT_GPS) 
     42    1, 
     43#else 
     44    0, 
     45#endif 
     46    EDGE_HMARGIN, CAM_TS_BUTTON_BORDER, 
     47}; 
     48 
     49//========================================================== 
    1550 
    1651volatile int chdk_started_flag=0; 
     
    193228 
    194229 
    195  
    196  
    197230#ifdef OPT_EDGEOVERLAY 
    198231            if(conf.edge_overlay_thresh && conf.edge_overlay_enable) { 
  • branches/reyalp-flt/core/module_exportlist.c

    r1494 r1512  
    2727#include "module_load.h" 
    2828#include "raw.h" 
     29#include "action_stack.h" 
     30#include "console.h" 
    2931 
    3032 
    3133extern int fselect_sort_nothumb(const void* v1, const void* v2); 
    3234extern short shooting_get_ev_correction1(); 
     35 
     36extern long shutter_open_time; // defined in platform/generic/capt_seq.c 
    3337 
    3438 
     
    4852 
    4953/* EXPORTED_DEFINES_BEGIN */ 
    50  
    51 int CAM_CHDK_BLACK_LEVEL = CAM_BLACK_LEVEL; 
    52 int CAM_CHDK_WHITE_LEVEL = CAM_WHITE_LEVEL; 
    53 int CAM_CHDK_RAW_ROWS    = CAM_RAW_ROWS   ; 
    54 int CAM_CHDK_RAW_ROWPIX  = CAM_RAW_ROWPIX ; 
    55 int RAW_CHDK_ROWLEN      = RAW_ROWLEN     ; 
    56  
    5754 
    5855char SCREEN__EXPORTEDSYM_COLOR        = SCREEN_COLOR            ; 
     
    8582char COLOR__EXPORTEDSYM_HISTO_RG_PLAY = COLOR_HISTO_RG_PLAY ; 
    8683 
    87 short EDGE__EXPORTEDSYM_HMARGIN = EDGE_HMARGIN; 
    88 short CAM__EXPORTEDSYM_TS_BUTTON_BORDER = CAM_TS_BUTTON_BORDER; 
    89  
    9084 
    9185/* EXPORTED_DEFINES_END */ 
     
    170164 
    171165                        // for rawop.flt 
    172             &CAM_CHDK_BLACK_LEVEL, 
    173             &CAM_CHDK_WHITE_LEVEL, 
    174             &CAM_CHDK_RAW_ROWS, 
    175             &CAM_CHDK_RAW_ROWPIX, 
    176             &RAW_CHDK_ROWLEN, 
    177166            GetFreeCardSpaceKb, 
    178167            debug_led, 
     
    181170                // for edgeovr.flt 
    182171                        vid_get_viewport_width, 
    183                         vid_get_viewport_buffer_width, 
     172            vid_get_viewport_byte_width, 
    184173            vid_get_viewport_xoffset, 
    185174            vid_get_viewport_yoffset, 
     175            vid_get_viewport_yscale, 
    186176            vid_get_viewport_fb_d, 
    187177            kbd_is_key_pressed, 
     
    287277                        &COLOR__EXPORTEDSYM_HISTO_RG_PLAY, 
    288278 
    289                         // some common required sym 
    290                         &EDGE__EXPORTEDSYM_HMARGIN, 
    291                         &CAM__EXPORTEDSYM_TS_BUTTON_BORDER, 
    292  
    293279                        // profile.flt 
    294280                        find_mnu, 
    295281                        lang_strhash31, 
    296282 
     283                        action_stack_create, 
     284                        action_pop, 
     285                        action_push, 
     286                        action_push_delay, 
     287                        action_stack_standard, 
     288                        console_clear, 
     289                        console_add_line, 
     290                        shooting_set_tv96_direct, 
     291                        shooting_get_iso_market, 
     292                        get_focal_length, 
     293                        get_effective_focal_length, 
     294                        get_parameter_data, 
     295                        get_property_case, 
     296                        &shutter_open_time, 
     297                        get_raw_pixel, 
     298                        &state_shooting_progress, 
     299                        patch_bad_pixel, 
     300                         
     301                        pow_calc, 
     302                        pow_calc_2, 
     303 
     304            &camera_info, 
    297305                        0 
    298306}; 
  • branches/reyalp-flt/core/module_load.c

    r1510 r1512  
    202202      ufree(reloc_buf);    
    203203 
     204  //extern int console_is_inited(); 
     205  extern volatile int chdk_started_flag; 
     206  if ( chdk_started_flag ) { 
    204207  char fmt[50]; 
    205208  strcpy(fmt,"Fail to load %s: "); 
     
    211214  console_clear(); 
    212215  console_add_line(buf); 
     216          msleep(1000); 
     217  } 
    213218 
    214219  return -1; 
     
    465470     close (module_fd); 
    466471 
    467    return (module_fd>=0); 
     472   return (module_fd>=0)?1:0; 
    468473} 
    469474 
  • branches/reyalp-flt/core/module_wrappers.c

    r1498 r1512  
    4040} 
    4141 
     42#define MAGICNUM_OPENDIR 0xf8bd35de 
    4243 
    4344//------------------------------------------------------- 
     
    5657 
    5758        memset( std, 0, sizeof(STD_DIR)); 
     59        std->magicnum = MAGICNUM_OPENDIR; 
    5860        std->dh = dh; 
    5961 
     
    6769 
    6870        if ( dir==0 ) return 0; 
     71        if ( dir->magicnum!=MAGICNUM_OPENDIR ) return 0; 
    6972        rv = closedir( dir->dh ); 
     73        dir->magicnum=0; 
    7074        free( dir ); 
    7175        return rv; 
     
    8892 
    8993        if ( dir==0 ) return 0; 
     94        if ( dir->magicnum!=MAGICNUM_OPENDIR ) return 0; 
    9095        de = readdir( dir->dh ); 
    9196 
  • branches/reyalp-flt/core/modules.c

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

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

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

    r1511 r1512  
    192192 
    193193void set_raw_pixel(unsigned int x, unsigned int y, unsigned short value) { 
     194    unsigned char* addr=(unsigned char*)get_raw_image_addr()+y*camera_info.raw_rowlen+(x/8)*camera_info.bits_per_pixel; 
    194195#if CAM_SENSOR_BITS_PER_PIXEL==10 
    195     unsigned char* addr=(unsigned char*)get_raw_image_addr()+y*RAW_ROWLEN+(x/8)*CAM_SENSOR_BITS_PER_PIXEL; 
    196196    switch (x%8) { 
    197197        case 0: addr[0]=(addr[0]&0x3F)|(value<<6); addr[1]=value>>2;                  break; 
     
    205205    } 
    206206#elif CAM_SENSOR_BITS_PER_PIXEL==12 
    207     unsigned char* addr=(unsigned char*)get_raw_image_addr()+y*RAW_ROWLEN+(x/4)*6; 
    208207    switch (x%4) { 
    209208        case 0: addr[0] = (addr[0]&0x0F) | (unsigned char)(value << 4);  addr[1] = (unsigned char)(value >> 4);  break; 
     
    219218//------------------------------------------------------------------- 
    220219unsigned short get_raw_pixel(unsigned int x,unsigned  int y) { 
     220    unsigned char* addr=(unsigned char*)get_raw_image_addr()+y*camera_info.raw_rowlen+(x/8)*camera_info.bits_per_pixel; 
    221221#if CAM_SENSOR_BITS_PER_PIXEL==10 
    222     unsigned char* addr=(unsigned char*)get_raw_image_addr()+y*RAW_ROWLEN+(x/8)*CAM_SENSOR_BITS_PER_PIXEL; 
    223222    switch (x%8) { 
    224223        case 0: return ((0x3fc&(((unsigned short)addr[1])<<2)) | (addr[0] >> 6)); 
     
    232231    } 
    233232#elif CAM_SENSOR_BITS_PER_PIXEL==12 
    234     unsigned char* addr=(unsigned char*)get_raw_image_addr()+y*RAW_ROWLEN+(x/4)*6; 
    235233    switch (x%4) { 
    236234        case 0: return ((unsigned short)(addr[1]) << 4) | (addr[0] >> 4); 
     
    251249    int i,j; 
    252250    int val; 
    253     if ((x>=2) && (x<CAM_RAW_ROWPIX-2) && (y>=2) && (y<CAM_RAW_ROWS-2)) { 
     251    if ((x>=2) && (x<camera_info.raw_rowpix-2) && (y>=2) && (y<camera_info.raw_rows-2)) { 
    254252        if ((conf.bad_pixel_removal==1) || (conf.save_raw && conf.dng_raw)) {  // interpolation or DNG saving 
    255253            for (i=-2; i<=2; i+=2) 
  • branches/reyalp-flt/core/raw.h

    r1511 r1512  
    1616 
    1717//------------------------------------------------------------------- 
    18  
    19 #define RAW_ROWLEN ((CAM_RAW_ROWPIX*CAM_SENSOR_BITS_PER_PIXEL)/8) 
    20  
    21 //------------------------------------------------------------------- 
    2218extern int raw_savefile(); 
    2319extern void raw_postprocess(); 
  • branches/reyalp-flt/core/raw_merge.c

    r1494 r1512  
    3737 int result; 
    3838 if ((from==0) || (sub==0)) return 0; // bad pixel 
    39  result = from - sub + CAM_CHDK_BLACK_LEVEL; 
    40  if (result<CAM_CHDK_BLACK_LEVEL) result=CAM_CHDK_BLACK_LEVEL; 
    41  if (result>CAM_CHDK_WHITE_LEVEL) result=CAM_CHDK_WHITE_LEVEL; 
     39 result = from - sub + camera_info.black_level; 
     40 if (result<camera_info.black_level) result=camera_info.black_level; 
     41 if (result>camera_info.white_level) result=camera_info.white_level; 
    4242 return result; 
    4343 
     
    6464        return 0; 
    6565 
    66      if( (baccum=malloc(RAW_CHDK_ROWLEN)) && 
    67         (bsub=malloc(RAW_CHDK_ROWLEN)) && 
     66     if( (baccum=malloc(camera_info.raw_rowlen)) && 
     67        (bsub=malloc(camera_info.raw_rowlen)) && 
    6868        (ffrom=fopen(from, "rb")) && 
    6969        (fsub=fopen(sub, "rb")) && 
     
    7272    { 
    7373        started(); 
    74         for (j = 0; j < CAM_CHDK_RAW_ROWS; j++) { 
    75             fread(baccum,1, RAW_CHDK_ROWLEN,ffrom); 
    76             fread(bsub,1, RAW_CHDK_ROWLEN,fsub); 
     74        for (j = 0; j < camera_info.raw_rows; j++) { 
     75            fread(baccum,1, camera_info.raw_rowlen,ffrom); 
     76            fread(bsub,1, camera_info.raw_rowlen,fsub); 
    7777 
    7878#if CAM_MODULE_SENSOR_BITS_PER_PIXEL==10 
    7979 
    80             for(i = 0;i<RAW_CHDK_ROWLEN; i+=10) { 
     80            for(i = 0;i<camera_info.raw_rowlen; i+=10) { 
    8181                s =((0x3fc&(((unsigned short)bsub[i+1])<<2)) | (bsub[i+0] >> 6)); 
    8282                d =((0x3fc&(((unsigned short)baccum[i+1])<<2)) | (baccum[i+0] >> 6)); 
     
    133133#elif CAM_MODULE_SENSOR_BITS_PER_PIXEL==12 
    134134 
    135             for(i = 0;i<RAW_CHDK_ROWLEN; i+=6) { 
     135            for(i = 0;i<camera_info.raw_rowlen; i+=6) { 
    136136 
    137137                s=((0xFF0&(((unsigned short)bsub[i+1])<<4))   | (bsub[i+0] >> 4)); 
     
    164164#endif 
    165165 
    166             fwrite(baccum,1,RAW_CHDK_ROWLEN,fdest); 
     166            fwrite(baccum,1,camera_info.raw_rowlen,fdest); 
    167167            if ( (j & 0x1F) == 0 ) { 
    168                 gui_browser_progress_show((char *)dest, j*100/CAM_CHDK_RAW_ROWS); 
     168                gui_browser_progress_show((char *)dest, j*100/camera_info.raw_rows); 
    169169            } 
    170170        } 
     
    189189int raw_merge_start(int action){ 
    190190  unsigned int req, avail; 
    191   req=((CAM_CHDK_RAW_ROWPIX*CAM_CHDK_RAW_ROWS)>>18)+1; 
     191  req=((camera_info.raw_rows*camera_info.raw_rows)>>18)+1; 
    192192  avail=GetFreeCardSpaceKb()>>10; 
    193193  if (avail<req) { 
     
    198198  raw_action=action; 
    199199  raw_count=0; 
    200   row=malloc(CAM_CHDK_RAW_ROWPIX*sizeof(unsigned short)); 
     200  row=malloc(camera_info.raw_rows*sizeof(unsigned short)); 
    201201  if (!row) 
    202202    return 0; 
    203   rawrow=malloc(RAW_CHDK_ROWLEN); 
     203  rawrow=malloc(camera_info.raw_rowlen); 
    204204  if (!rawrow) { 
    205205    free(row); 
     
    230230      fbrawout=fopen(TEMP_FILE_NAME_1,"w+b"); 
    231231      if (fbrawout){ 
    232         fread(rawrow, 1, RAW_CHDK_ROWLEN, fcraw); 
     232        fread(rawrow, 1, camera_info.raw_rowlen, fcraw); 
    233233        if (raw_count)  
    234           fread(row, 1, CAM_CHDK_RAW_ROWPIX*sizeof(unsigned short), fbrawin);  
     234          fread(row, 1, camera_info.raw_rows*sizeof(unsigned short), fbrawin);  
    235235        else 
    236           for (i=0;i<CAM_CHDK_RAW_ROWPIX;i++) 
     236          for (i=0;i<camera_info.raw_rows;i++) 
    237237            row[i]=0; 
    238238 
    239         for (nrow=0,j=0;nrow<CAM_CHDK_RAW_ROWS;nrow++,j++){ 
     239        for (nrow=0,j=0;nrow<camera_info.raw_rows;nrow++,j++){ 
    240240 
    241241#if CAM_MODULE_SENSOR_BITS_PER_PIXEL==10 
    242242 
    243           for (i=0,src=0; i<CAM_CHDK_RAW_ROWPIX; i+=8, src+=10){ 
     243          for (i=0,src=0; i<camera_info.raw_rows; i+=8, src+=10){ 
    244244            row[i+0]+=((0x3fc&(((unsigned short)rawrow[src+1])<<2)) | (rawrow[src+0] >> 6)); 
    245245            row[i+1]+=((0x3f0&(((unsigned short)rawrow[src+0])<<4)) | (rawrow[src+3] >> 4)); 
     
    254254#elif CAM_MODULE_SENSOR_BITS_PER_PIXEL==12 
    255255 
    256           for (i=0,src=0; i<CAM_CHDK_RAW_ROWPIX; i+=4, src+=6){ 
     256          for (i=0,src=0; i<camera_info.raw_rows; i+=4, src+=6){ 
    257257            row[i+0]+=((0xFF0&(((unsigned short)rawrow[src+1])<<4)) | (rawrow[src+0] >> 4)); 
    258258            row[i+1]+=((0xF00&(((unsigned short)rawrow[src+0])<<8)) | (rawrow[src+3]     )); 
     
    265265#endif 
    266266 
    267           fwrite(row, 1, CAM_CHDK_RAW_ROWPIX*sizeof(unsigned short), fbrawout); 
     267          fwrite(row, 1, camera_info.raw_rows*sizeof(unsigned short), fbrawout); 
    268268          if (raw_count) 
    269             fread(row, 1, CAM_CHDK_RAW_ROWPIX*sizeof(unsigned short), fbrawin); 
     269            fread(row, 1, camera_info.raw_rows*sizeof(unsigned short), fbrawin); 
    270270          else 
    271             for (i=0;i<CAM_CHDK_RAW_ROWPIX;i++) 
     271            for (i=0;i<camera_info.raw_rows;i++) 
    272272              row[i]=0; 
    273           fread(rawrow, 1, RAW_CHDK_ROWLEN, fcraw); 
    274           if (j>=CAM_CHDK_RAW_ROWS/10) { 
    275             j-=CAM_CHDK_RAW_ROWS/10; 
    276             gui_browser_progress_show(filename, nrow*100/CAM_CHDK_RAW_ROWS); 
     273          fread(rawrow, 1, camera_info.raw_rowlen, fcraw); 
     274          if (j>=camera_info.raw_rows/10) { 
     275            j-=camera_info.raw_rows/10; 
     276            gui_browser_progress_show(filename, nrow*100/camera_info.raw_rows); 
    277277          } 
    278278        } 
     
    309309    fcraw=fopen(namebuf,"w+b"); 
    310310    if (fcraw) { 
    311       fread(row, 1, CAM_CHDK_RAW_ROWPIX*sizeof(unsigned short), fbraw); 
    312       for (nrow=0,j=0;nrow<CAM_CHDK_RAW_ROWS;nrow++,j++) { 
    313         for (i=0;i<CAM_CHDK_RAW_ROWPIX;i++) { 
     311      fread(row, 1, camera_info.raw_rows*sizeof(unsigned short), fbraw); 
     312      for (nrow=0,j=0;nrow<camera_info.raw_rows;nrow++,j++) { 
     313        for (i=0;i<camera_info.raw_rows;i++) { 
    314314          if (raw_action==RAW_OPERATION_AVERAGE) 
    315315            row[i]/=raw_count; 
    316316          else { 
    317             if (row[i]>CAM_CHDK_BLACK_LEVEL*(raw_count-1)) 
    318               row[i]-=CAM_CHDK_BLACK_LEVEL*(raw_count-1); 
     317            if (row[i]>camera_info.black_level*(raw_count-1)) 
     318              row[i]-=camera_info.black_level*(raw_count-1); 
    319319            else 
    320320              row[i]=0; 
    321             if (row[i]>CAM_CHDK_WHITE_LEVEL) 
    322               row[i]=CAM_CHDK_WHITE_LEVEL; 
     321            if (row[i]>camera_info.white_level) 
     322              row[i]=camera_info.white_level; 
    323323          } 
    324324        } 
    325325#if CAM_MODULE_SENSOR_BITS_PER_PIXEL==10 
    326         for (i=0,src=0;i<CAM_CHDK_RAW_ROWPIX;i+=8,src+=10) { 
     326        for (i=0,src=0;i<camera_info.raw_rows;i+=8,src+=10) { 
    327327          rawrow[src+0]=(row[i+0]<<6)|(row[i+1]>>4); 
    328328          rawrow[src+1]=(row[i+0]>>2); 
     
    337337        } 
    338338#elif CAM_MODULE_SENSOR_BITS_PER_PIXEL==12 
    339         for (i=0,src=0; i<CAM_CHDK_RAW_ROWPIX; i+=4, src+=6){ 
     339        for (i=0,src=0; i<camera_info.raw_rows; i+=4, src+=6){ 
    340340          rawrow[src+0]=(row[i+0]<<4)|(row[i+1]>>8); 
    341341          rawrow[src+1]=(row[i+0]>>4); 
     
    349349#endif 
    350350 
    351         fwrite(rawrow, 1, RAW_CHDK_ROWLEN, fcraw); 
    352         fread(row, 1, CAM_CHDK_RAW_ROWPIX*sizeof(unsigned short), fbraw); 
    353         if (j>=CAM_CHDK_RAW_ROWS/5) { 
    354           j-=CAM_CHDK_RAW_ROWS/5; 
    355           gui_browser_progress_show(namebuf, nrow*100/CAM_CHDK_RAW_ROWS); 
     351        fwrite(rawrow, 1, camera_info.raw_rowlen, fcraw); 
     352        fread(row, 1, camera_info.raw_rows*sizeof(unsigned short), fbraw); 
     353        if (j>=camera_info.raw_rows/5) { 
     354          j-=camera_info.raw_rows/5; 
     355          gui_browser_progress_show(namebuf, nrow*100/camera_info.raw_rows); 
    356356        } 
    357357      } 
  • branches/reyalp-flt/core/shot_histogram.c

    r720 r1512  
    5555 memset(shot_histogram,0,SHOT_HISTOGRAM_SIZE); 
    5656  
    57  marginstep= (CAM_RAW_ROWPIX - 2 * SHOT_HISTOGRAM_MARGIN)/10; 
     57 marginstep= (camera_info.raw_rowpix - 2 * SHOT_HISTOGRAM_MARGIN)/10; 
    5858 
    5959 // In future, support definition of a sort of "spot metering"  
    6060 x0 = SHOT_HISTOGRAM_MARGIN + shot_margin_left * marginstep; 
    61  x1 = CAM_RAW_ROWPIX - SHOT_HISTOGRAM_MARGIN - shot_margin_right * marginstep; 
     61 x1 = camera_info.raw_rowpix - SHOT_HISTOGRAM_MARGIN - shot_margin_right * marginstep; 
    6262 y0 = SHOT_HISTOGRAM_MARGIN + shot_margin_top * marginstep; 
    63  y1 = CAM_RAW_ROWS - SHOT_HISTOGRAM_MARGIN - shot_margin_bottom * marginstep; 
     63 y1 = camera_info.raw_rows - SHOT_HISTOGRAM_MARGIN - shot_margin_bottom * marginstep; 
    6464 
    6565 //x0 = SHOT_HISTOGRAM_MARGIN ; 
    66  //x1 = CAM_RAW_ROWPIX - SHOT_HISTOGRAM_MARGIN ; 
     66 //x1 = camera_info.raw_rowpix - SHOT_HISTOGRAM_MARGIN ; 
    6767 //y0 = SHOT_HISTOGRAM_MARGIN; 
    68  //y1 = CAM_RAW_ROWS - SHOT_HISTOGRAM_MARGIN; 
     68 //y1 = camera_info.raw_rows - SHOT_HISTOGRAM_MARGIN; 
    6969 
    7070  
  • branches/reyalp-flt/include/camera.h

    r1493 r1512  
    145145#undef  DNG_EXT_FROM                            // Extension in the cameras known extensions to replace with .DNG to allow DNG 
    146146                                                // files to be transfered over standard PTP. Only applicable to older cameras 
    147 #undef  DNG_VERT_RLE_BADPIXELS                  // Enable vertical run length compression of badpixel data for DNG 
    148                                                 // IXUS 310 HS bad pixels tend to be grouped into vertical lines of 1-4 pixels 
    149                                                 // This reduces the file size by approx 45% 
    150147 
    151148#undef  CAM_DNG_LENS_INFO                       // Define this to include camera lens information in DNG files 
     
    217214#endif 
    218215 
     216//========================================================== 
     217// Data Structure to store camera specific information 
     218// Used by modules to ensure module code is platform independent 
     219 
     220typedef struct { 
     221    int bits_per_pixel; 
     222    int black_level; 
     223    int white_level; 
     224    int raw_rows, raw_rowpix, raw_rowlen, raw_size; 
     225    union                       // DNG JPEG info 
     226    { 
     227        struct 
     228        { 
     229            int x, y;           // DNG JPEG top left corner 
     230            int width, height;  // DNG JPEG size 
     231        } jpeg; 
     232        struct 
     233        { 
     234            int origin[2]; 
     235            int size[2]; 
     236        } crop; 
     237    }; 
     238    union                       // DNG active sensor area (Y1, X1, Y2, X2) 
     239    { 
     240        struct 
     241        { 
     242            int y1, x1, y2, x2; 
     243        } active_area; 
     244        int dng_active_area[4]; 
     245    }; 
     246    int lens_info[8];           // DNG Lens Info 
     247    int exposure_bias[2];       // DNG Exposure Bias 
     248    int color_matrix1[18];      // DNG Color Matrix 
     249    int cfa_pattern, calibration_illuminant1; 
     250    int has_gps; 
     251    int edge_hmargin, ts_button_border; 
     252} _cam_info; 
     253 
     254extern _cam_info camera_info; 
     255 
     256//========================================================== 
     257 
    219258#endif /* CAMERA_H */ 
  • branches/reyalp-flt/include/stdlib_unified.h

    r1498 r1512  
    3939// This is directory handler. 
    4040typedef struct { 
     41        int magicnum;           // to safe second try to close 
    4142        void* dh; 
    4243    struct STD_dirent de; 
  • branches/reyalp-flt/platform/g12/platform_camera.h

    r1511 r1512  
    5656    // camera name 
    5757    #define PARAM_CAMERA_NAME               4   // parameter number for GetParameterData 
    58     #define PARAM_DISPLAY_MODE1             59  // param number for LCD display mode when camera in playback 
    59     #define PARAM_DISPLAY_MODE2             62  // param number for LCD display mode when camera in record view hold mode 
    6058    #define PARAM_DISPLAY_MODE1             59  // param number for LCD display mode when camera in playback 
    6159    #define PARAM_DISPLAY_MODE2             62  // param number for LCD display mode when camera in record view hold mode 
  • branches/reyalp-flt/platform/ixus310_elph500hs/platform_camera.h

    r1511 r1512  
    7070    #define PARAM_DISPLAY_MODE1             60 // param number for LCD display mode when camera in playback 
    7171    #define PARAM_DISPLAY_MODE2             64  // param number for LCD display mode when camera in record view hold mode 
    72     #define PARAM_DISPLAY_MODE1             60 // param number for LCD display mode when camera in playback 
    73     #define PARAM_DISPLAY_MODE2             64  // param number for LCD display mode when camera in record view hold mode 
    7472    #undef  CAM_SENSOR_BITS_PER_PIXEL 
    7573    #define CAM_SENSOR_BITS_PER_PIXEL       12 
     
    118116    #define CAM_DISABLE_RAW_IN_LOW_LIGHT_MODE 1       // For cameras with 'low light' mode that does now work with raw define this 
    119117 
    120     #define DNG_VERT_RLE_BADPIXELS          1   // Enable vertical run length compression of bad pixels, reduces badpixel.bin file size by approx 45% 
    121  
    122118    #define CAM_LOAD_CUSTOM_COLORS          1       // Enable loading CHDK colors into the camera palette memory/hardware 
    123119    #define CHDK_COLOR_BASE                 0xA2    // Start color index for CHDK colors loaded into camera palette. 
Note: See TracChangeset for help on using the changeset viewer.