Changeset 1512
- Timestamp:
- 12/28/11 22:34:31 (17 months ago)
- Location:
- branches/reyalp-flt
- Files:
-
- 28 edited
-
core/console.c (modified) (1 diff)
-
core/curves.c (modified) (4 diffs)
-
core/dng.c (modified) (20 diffs)
-
core/edgeoverlay.c (modified) (5 diffs)
-
core/gui_4wins.c (modified) (6 diffs)
-
core/gui_calendar.c (modified) (2 diffs)
-
core/gui_mastermind.c (modified) (7 diffs)
-
core/gui_osd.c (modified) (1 diff)
-
core/gui_palette.c (modified) (1 diff)
-
core/gui_read.c (modified) (4 diffs)
-
core/gui_reversi.c (modified) (3 diffs)
-
core/gui_sokoban.c (modified) (6 diffs)
-
core/gui_tetris.c (modified) (4 diffs)
-
core/main.c (modified) (2 diffs)
-
core/module_exportlist.c (modified) (6 diffs)
-
core/module_load.c (modified) (3 diffs)
-
core/module_wrappers.c (modified) (4 diffs)
-
core/modules.c (modified) (2 diffs)
-
core/modules.h (modified) (1 diff)
-
core/modules/Makefile (modified) (3 diffs)
-
core/raw.c (modified) (5 diffs)
-
core/raw.h (modified) (1 diff)
-
core/raw_merge.c (modified) (13 diffs)
-
core/shot_histogram.c (modified) (1 diff)
-
include/camera.h (modified) (2 diffs)
-
include/stdlib_unified.h (modified) (1 diff)
-
platform/g12/platform_camera.h (modified) (1 diff)
-
platform/ixus310_elph500hs/platform_camera.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/reyalp-flt/core/console.c
r1493 r1512 131 131 { 132 132 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; 134 134 135 135 for(c = 0; c < console_num_lines; ++c) -
branches/reyalp-flt/core/curves.c
r1494 r1512 146 146 147 147 // Loop through picture rows 148 for (i= CAM_CHDK_RAW_ROWS; i;i-=2){148 for (i=camera_info.raw_rows; i;i-=2){ 149 149 // 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){ 151 151 pixVal0=((0x3fc&(((unsigned short)(src[1]))<<2)) | (src[0] >> 6)); 152 152 pixVal1=((0x3f0&(((unsigned short)(src[0]))<<4)) | (src[3] >> 4)); … … 179 179 *(src+8) = (unsigned char) ((pixVal0)); //7 (=>0) } 180 180 } 181 for (j= CAM_CHDK_RAW_ROWPIX;j; j-=8, src+=10){181 for (j=camera_info.raw_rows;j; j-=8, src+=10){ 182 182 pixVal0=((0x3fc&(((unsigned short)(src[1]))<<2)) | (src[0] >> 6)); 183 183 pixVal1=((0x3f0&(((unsigned short)(src[0]))<<4)) | (src[3] >> 4)); … … 242 242 243 243 // Loop through picture rows 244 for (i= CAM_CHDK_RAW_ROWS; i;i-=2){244 for (i=camera_info.raw_rows; i;i-=2){ 245 245 // 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){ 247 247 pixVal0=((0x3fc&(((unsigned short)(src[1]))<<2)) | (src[0] >> 6)); 248 248 pixVal1=((0x3f0&(((unsigned short)(src[0]))<<4)) | (src[3] >> 4)); … … 307 307 *(src+8) = (unsigned char) ((pixVal0)); //7 (=>0) 308 308 } 309 for (j= CAM_CHDK_RAW_ROWPIX;j; j-=8, src+=10){309 for (j=camera_info.raw_rows;j; j-=8, src+=10){ 310 310 pixVal0=((0x3fc&(((unsigned short)(src[1]))<<2)) | (src[0] >> 6)); 311 311 pixVal1=((0x3f0&(((unsigned short)(src[0]))<<4)) | (src[3] >> 4)); -
branches/reyalp-flt/core/dng.c
r1511 r1512 1 1 #include "camera.h" 2 3 #if DNG_SUPPORT4 2 5 3 #include "stdlib.h" … … 7 5 #include "platform.h" 8 6 #include "conf.h" 9 #include "console.h"10 7 #include "console.h" 11 8 #include "dng.h" … … 22 19 struct dir_entry{unsigned short tag; unsigned short type; unsigned int count; unsigned int offset;}; 23 20 24 #define T_BYTE 125 #define T_ASCII 226 #define T_SHORT 327 #define T_LONG 428 #define T_RATIONAL 529 #define T_SBYTE 621 #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 30 27 #define T_UNDEFINED 7 31 #define T_SSHORT 832 #define T_SLONG 928 #define T_SSHORT 8 29 #define T_SLONG 9 33 30 #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) 39 34 40 35 unsigned short get_exp_program_for_exif(int exp_program); … … 43 38 unsigned short get_metering_mode_for_exif(short metering_mode); 44 39 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}; 40 const int cam_BaselineNoise[] = {1,1}; 41 const int cam_BaselineSharpness[] = {4,3}; 42 const int cam_LinearResponseLimit[] = {1,1}; 43 const int cam_AnalogBalance[] = {1,1,1,1,1,1}; 61 44 const 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 } 45 const short cam_PreviewBitsPerSample[] = {8,8,8}; 46 const char cam_chdk_ver[] = HDK_VERSION" ver. "BUILD_NUMBER; 47 const int cam_Resolution[] = {180,1}; 48 int cam_AsShotNeutral[] = {1000,1000,1000,1000,1000,1000}; 222 49 223 50 struct t_data_for_exif{ … … 233 60 static struct t_data_for_exif exif_data; 234 61 62 // warning: according to TIFF format specification, elements must be sorted by tag value in ascending order! 63 64 struct 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 102 struct 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 128 static int cam_shutter[2] = { 0, 1000000 }; // Shutter speed 129 static int cam_aperture[2] = { 0, 10 }; // Aperture 130 static char cam_datetime[20] = ""; // DateTimeOriginal 131 static int cam_apex_shutter[2] = { 0, 96 }; // Shutter speed in APEX units 132 static int cam_apex_aperture[2] = { 0, 96 }; // Aperture in APEX units 133 static int cam_exp_bias[2] = { 0, 96 }; 134 static int cam_max_av[2] = { 0, 96 }; 135 static int cam_focal_length[2] = { 0, 1000 }; 136 137 struct 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 156 typedef 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; 169 tGPS gps_data; 170 171 struct 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 188 int 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 206 struct {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 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 } 222 235 223 void create_dng_header(){ 236 224 int var; … … 240 228 241 229 // 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)); 261 235 262 236 for (j=0;j<IFDs;j++) { … … 267 241 case 0xC614: IFD_LIST[j].entry[i].count = strlen((char*)IFD_LIST[j].entry[i].offset) + 1; break; // UniqueCameraModel 268 242 case 0x132 : 269 case 0x8827: IFD_LIST[j].entry[i].offset=exif_data.iso; break;//ISOSpeedRatings270 243 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; ////FocalLengthIn35mmFilm272 244 case 0x0112: IFD_LIST[j].entry[i].offset=get_orientation_for_exif(exif_data.orientation); break; //Orientation 273 245 case 0x9209: IFD_LIST[j].entry[i].offset=get_flash_mode_for_exif(exif_data.flash_mode, exif_data.flash_fired); break; //Flash mode 274 246 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 #endif287 247 } 288 248 } … … 329 289 for(i=0; IFD_LIST[j].entry[i].tag; i++) { 330 290 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)332 291 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 #endif334 292 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 335 293 if (IFD_LIST[j].entry[i].tag==0x111) { … … 357 315 add_to_buf(&var, sizeof(short)); 358 316 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 } 368 338 } 369 339 var=0; … … 477 447 478 448 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; 480 450 481 451 get_property_case(PROPCASE_ORIENTATION_SENSOR, &exif_data.orientation, sizeof(exif_data.orientation)); … … 501 471 struct utimbuf t; 502 472 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; 504 474 buf=malloc(BUF_SIZE); 505 475 if (buf){ … … 513 483 raw=fopen(fn,"w+b"); 514 484 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++) { 517 487 fread(buf, 1, BUF_SIZE, dng); 518 488 reverse_bytes_order((char*)buf, BUF_SIZE); 519 489 fwrite(buf, 1, BUF_SIZE, raw); 520 490 } 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); 524 494 fclose(raw); 525 495 t.actime = t.modtime = time(NULL); … … 542 512 int i; 543 513 if (gamma[255]) return; 544 #if defined(CAMERA_sx30) || defined(CAMERA_sx40hs) || defined(CAMERA_g12) || defined(CAMERA_ixus310_elph500hs)545 514 for (i=0; i<12; i++) gamma[i]=pow_calc_2(255, i, 255, 0.5, 1); 546 515 for (i=12; i<64; i++) gamma[i]=pow_calc_2(255, i, 255, 0.4, 1); 547 516 for (i=64; i<=255; i++) gamma[i]=pow_calc_2(255, i, 255, 0.25, 1); 548 #else549 for (i=0; i<=255; i++) gamma[i]=pow_calc_2(255, i, 255, 0.5, 1);550 #endif551 517 } 552 518 553 519 void create_thumbnail() { 554 register int i, j, x, y ;520 register int i, j, x, y, yadj; 555 521 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; 556 530 557 531 for (i=0; i<DNG_TH_HEIGHT; i++) 558 532 for (j=0; j<DNG_TH_WIDTH; j++) 559 533 { 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 574 540 } 575 541 } … … 599 565 } 600 566 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]++) 603 568 { 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]++) 605 570 { 606 571 if (get_raw_pixel(c[0],c[1])==0) … … 615 580 } 616 581 } 617 #else618 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 #endif630 582 if (f) fclose(f); 631 583 init_badpixel_bin_flag = count; … … 672 624 int i; 673 625 short* ptr=binary_list; 674 #ifdef DNG_VERT_RLE_BADPIXELS675 626 short y, cnt; 676 627 for (i=0; i<binary_count; i++, ptr+=2) … … 682 633 patch_bad_pixel(ptr[0], y); 683 634 } 684 #else685 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 #endif689 635 } 690 636 … … 773 719 774 720 //------------------------------------------------------------------- 775 // Write DNG header and thumbnailto file776 777 void write_dng _header(int fd)721 // Write DNG header, thumbnail and data to file 722 723 void write_dng(int fd, char* rawadr, char* altrawadr, unsigned long uncachedbit) 778 724 { 725 create_dng_header(); 726 779 727 if (dng_header_buf) 780 728 { … … 784 732 write(fd, dng_header_buf, dng_header_buf_size); 785 733 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 } 804 745 } 805 746 … … 842 783 return 0; 843 784 } 844 845 846 #else847 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 empty855 return 1;856 }857 858 859 //---------------------------------------------------------860 // PURPOSE: Finalize module operations (close allocs, etc)861 // RETURN VALUE: 0-ok, 1-fail862 //---------------------------------------------------------863 int _module_unloader()864 {865 return 0;866 }867 868 869 #endif //DNG_SUPPORT870 785 871 786 -
branches/reyalp-flt/core/edgeoverlay.c
r1511 r1512 48 48 static void get_viewport_size() 49 49 { 50 viewport_height = vid_get_viewport_height()- EDGE_HMARGIN*2; //don't trace bottom lines50 viewport_height = vid_get_viewport_height()-camera_info.edge_hmargin*2; //don't trace bottom lines 51 51 viewport_width = vid_get_viewport_width(); 52 52 viewport_byte_width = vid_get_viewport_byte_width(); … … 290 290 int conv1, conv2; 291 291 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; 294 294 const int x_min = viewport_xoffset*3 + 6; 295 295 const int x_max = (viewport_width + viewport_xoffset - 2) * 3; … … 387 387 if (conv1 + conv2 > *conf_edge_overlay_thresh) 388 388 { 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); 390 390 } 391 391 … … 417 417 if (conv1 + conv2 > *conf_edge_overlay_thresh) 418 418 { 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); 420 420 } 421 421 } // for x … … 493 493 494 494 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; 499 499 const int x_min = viewport_xoffset+2; 500 500 const int x_max = (viewport_width + viewport_xoffset - 2); -
branches/reyalp-flt/core/gui_4wins.c
r1494 r1512 22 22 23 23 #define BORDER 20 24 #define XBORDER ( CAM_TS_BUTTON_BORDER+BORDER)24 #define XBORDER (camera_info.ts_button_border+BORDER) 25 25 #define RECT_SIZE 30 26 26 #define BORDER_TOP RECT_SIZE … … 180 180 w=l*FONT_WIDTH+10; 181 181 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); 183 183 draw_filled_round_rect(x, y, x+w, y+FONT_HEIGHT+6, MAKE_COLOR(COLOR_RED, COLOR_RED)); 184 184 draw_string(x+((w-strlen(text)*FONT_WIDTH)>>1), y+4, text, cl); … … 245 245 void draw_mode() 246 246 { 247 int x = ( CAM_TS_BUTTON_BORDER/FONT_WIDTH) + 30;247 int x = (camera_info.ts_button_border/FONT_WIDTH) + 30; 248 248 draw_txt_string(x, 4, " ", TEXT_COLOR); 249 249 if (mode_rival==1) … … 311 311 draw_filled_rect(0, 0, screen_width, screen_height, BG_COLOR); // draw backgraund 312 312 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); 316 316 317 317 for(i=0;i<7;i++) … … 329 329 330 330 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); 332 332 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)); 334 334 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); 336 336 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)); 338 338 draw_mode(); 339 339 if(cur_player==2&&!mode_rival) set(); … … 370 370 static char str[16]; 371 371 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); 374 374 } 375 375 -
branches/reyalp-flt/core/gui_calendar.c
r1494 r1512 69 69 70 70 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)); 72 72 draw_rect(cal_x-3, cal_y-3, cal_x+cal_w+2, cal_y+cal_h+2, CALENDAR_COLOR); 73 73 draw_filled_rect(cal_x-1, cal_y-1, cal_x+cal_w, cal_y+FONT_HEIGHT+8, TITLE_COLOR); … … 139 139 ttm = localtime(&t); 140 140 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)); 142 142 143 143 if (need_redraw) { -
branches/reyalp-flt/core/gui_mastermind.c
r1494 r1512 35 35 static void guess_box(int pos, color col) 36 36 { 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)); 38 38 } 39 39 … … 84 84 curr_color[1]==curr_color[2] || curr_color[1]==curr_color[3] || curr_color[2]==curr_color[3]) 85 85 { 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); 87 87 return 0; 88 88 } … … 117 117 for (i=0;i<4;i++) 118 118 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)); 124 124 125 125 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])); 127 127 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); 133 133 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); 135 135 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); 139 139 140 140 for(i=0;i<4;i++) curr_color[i]=99; … … 148 148 { 149 149 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)); 151 151 } 152 152 … … 154 154 { 155 155 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); 157 157 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]])); 159 159 } 160 160 … … 178 178 if (GameGo == 1) 179 179 { 180 draw_string( CAM_TS_BUTTON_BORDER+167, 130 , " ", TEXT_COLOR);180 draw_string(camera_info.ts_button_border+167, 130 , " ", TEXT_COLOR); 181 181 switch (kbd_get_autoclicked_key()) 182 182 { … … 230 230 static struct tm *ttm; 231 231 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)); 233 233 234 234 t = time(NULL); 235 235 ttm = localtime(&t); 236 236 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); 238 238 } 239 239 -
branches/reyalp-flt/core/gui_osd.c
r1511 r1512 1154 1154 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) 1155 1155 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) { 1157 1157 gui_print_osd_state_string_int("SD:",shooting_get_subject_distance_override_value()); 1158 1158 if (gui_mode==GUI_MODE_ALT) -
branches/reyalp-flt/core/gui_palette.c
r1489 r1512 79 79 static char buf[64]; 80 80 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; 83 83 84 84 if (gui_palette_redraw) -
branches/reyalp-flt/core/gui_read.c
r1494 r1512 44 44 static void gui_read_draw_batt() { 45 45 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)); 47 47 } 48 48 … … 55 55 ttm = localtime(&t); 56 56 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)); 58 58 } 59 59 60 60 //------------------------------------------------------------------- 61 61 static 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 infoline62 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 63 63 } 64 64 … … 78 78 pause = 0; 79 79 read_to_draw = 1; 80 x= CAM_TS_BUTTON_BORDER+6;80 x=camera_info.ts_button_border+6; 81 81 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; 83 83 h=screen_height-y; 84 84 last_time = get_tick_count(); … … 188 188 sprintf(buffer, "(%3d%%) %d/%d ", (read_file_size)?(*conf_reader_pos*100/read_file_size):0, *conf_reader_pos, read_file_size); 189 189 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 infoline190 draw_txt_string((camera_info.ts_button_border/FONT_WIDTH), 0, buffer, MAKE_COLOR(COLOR_BLACK, COLOR_WHITE)); //title infoline 191 191 192 192 // scrollbar -
branches/reyalp-flt/core/gui_reversi.c
r1494 r1512 227 227 228 228 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; 230 230 field_y = (screen_height-field_size)>>1; 231 231 cell_size = field_size >> 3; … … 329 329 //------------------------------------------------------------------- 330 330 static 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; 332 332 if (InGame) { 333 333 if (CurrPlayer==FIELD_PLAYER1) { … … 410 410 411 411 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)); 413 413 414 414 Timer(); -
branches/reyalp-flt/core/gui_sokoban.c
r1494 r1512 259 259 //------------------------------------------------------------------- 260 260 static 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); 266 266 } 267 267 … … 394 394 switch (field[y][x]) { 395 395 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)); 397 397 break; 398 398 case MARKER_BOX: … … 400 400 break; 401 401 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)); 404 404 break; 405 405 case MARKER_BOX_PLACE: … … 408 408 case MARKER_PLAYER: 409 409 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)); 412 412 break; 413 413 case MARKER_EMPTY: 414 414 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)); 416 416 break; 417 417 } … … 419 419 } 420 420 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); 423 423 424 424 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)); 426 426 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)); 428 428 429 429 //draw_filled_rect(cell_size*FIELD_WIDTH+2, 8+FONT_HEIGHT*2, screen_width-1, screen_height-1, MAKE_COLOR(SCREEN_COLOR, SCREEN_COLOR)); … … 436 436 437 437 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)); 439 439 } 440 440 -
branches/reyalp-flt/core/gui_tetris.c
r1494 r1512 158 158 for (j = 0; j < 4; ++j) { 159 159 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), 161 161 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, 163 163 PREVIEW_Y + (TILE_SIZE * j)+TILE_SIZE-1, 164 164 MAKE_COLOR(game->nextBlock.cells[i][j], game->nextBlock.cells[i][j])); 165 165 }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), 167 167 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, 169 169 PREVIEW_Y + (TILE_SIZE * j)+TILE_SIZE-1, 170 170 TETRIS_COLOR_BG); … … 194 194 for (j = 0; j < BOARD_HEIGHT; ++j){ 195 195 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), 197 197 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, 199 199 BOARD_Y + (TILE_SIZE * j)+TILE_SIZE-1, 200 200 MAKE_COLOR(tmp[i][j], tmp[i][j])); 201 201 }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), 203 203 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, 205 205 BOARD_Y + (TILE_SIZE * j)+TILE_SIZE-1, 206 206 MAKE_COLOR(tmp2[i][j], tmp2[i][j])); 207 207 }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), 209 209 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, 211 211 BOARD_Y + (TILE_SIZE * j)+TILE_SIZE-1, 212 212 TETRIS_COLOR_BOARD); … … 219 219 static struct tm *ttm; 220 220 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)); 222 222 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)); 224 224 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)); 226 226 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)); 228 228 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)); 230 230 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)); 232 232 t = time(NULL); 233 233 ttm = localtime(&t); 234 234 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)); 236 236 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)); 238 238 } 239 239 … … 665 665 666 666 void 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); 669 669 game = createGame(); 670 670 gameInit(game); -
branches/reyalp-flt/core/main.c
r1511 r1512 13 13 #include "module_load.h" 14 14 #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 //========================================================== 15 50 16 51 volatile int chdk_started_flag=0; … … 193 228 194 229 195 196 197 230 #ifdef OPT_EDGEOVERLAY 198 231 if(conf.edge_overlay_thresh && conf.edge_overlay_enable) { -
branches/reyalp-flt/core/module_exportlist.c
r1494 r1512 27 27 #include "module_load.h" 28 28 #include "raw.h" 29 #include "action_stack.h" 30 #include "console.h" 29 31 30 32 31 33 extern int fselect_sort_nothumb(const void* v1, const void* v2); 32 34 extern short shooting_get_ev_correction1(); 35 36 extern long shutter_open_time; // defined in platform/generic/capt_seq.c 33 37 34 38 … … 48 52 49 53 /* 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 57 54 58 55 char SCREEN__EXPORTEDSYM_COLOR = SCREEN_COLOR ; … … 85 82 char COLOR__EXPORTEDSYM_HISTO_RG_PLAY = COLOR_HISTO_RG_PLAY ; 86 83 87 short EDGE__EXPORTEDSYM_HMARGIN = EDGE_HMARGIN;88 short CAM__EXPORTEDSYM_TS_BUTTON_BORDER = CAM_TS_BUTTON_BORDER;89 90 84 91 85 /* EXPORTED_DEFINES_END */ … … 170 164 171 165 // 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,177 166 GetFreeCardSpaceKb, 178 167 debug_led, … … 181 170 // for edgeovr.flt 182 171 vid_get_viewport_width, 183 vid_get_viewport_buffer_width,172 vid_get_viewport_byte_width, 184 173 vid_get_viewport_xoffset, 185 174 vid_get_viewport_yoffset, 175 vid_get_viewport_yscale, 186 176 vid_get_viewport_fb_d, 187 177 kbd_is_key_pressed, … … 287 277 &COLOR__EXPORTEDSYM_HISTO_RG_PLAY, 288 278 289 // some common required sym290 &EDGE__EXPORTEDSYM_HMARGIN,291 &CAM__EXPORTEDSYM_TS_BUTTON_BORDER,292 293 279 // profile.flt 294 280 find_mnu, 295 281 lang_strhash31, 296 282 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, 297 305 0 298 306 }; -
branches/reyalp-flt/core/module_load.c
r1510 r1512 202 202 ufree(reloc_buf); 203 203 204 //extern int console_is_inited(); 205 extern volatile int chdk_started_flag; 206 if ( chdk_started_flag ) { 204 207 char fmt[50]; 205 208 strcpy(fmt,"Fail to load %s: "); … … 211 214 console_clear(); 212 215 console_add_line(buf); 216 msleep(1000); 217 } 213 218 214 219 return -1; … … 465 470 close (module_fd); 466 471 467 return (module_fd>=0) ;472 return (module_fd>=0)?1:0; 468 473 } 469 474 -
branches/reyalp-flt/core/module_wrappers.c
r1498 r1512 40 40 } 41 41 42 #define MAGICNUM_OPENDIR 0xf8bd35de 42 43 43 44 //------------------------------------------------------- … … 56 57 57 58 memset( std, 0, sizeof(STD_DIR)); 59 std->magicnum = MAGICNUM_OPENDIR; 58 60 std->dh = dh; 59 61 … … 67 69 68 70 if ( dir==0 ) return 0; 71 if ( dir->magicnum!=MAGICNUM_OPENDIR ) return 0; 69 72 rv = closedir( dir->dh ); 73 dir->magicnum=0; 70 74 free( dir ); 71 75 return rv; … … 88 92 89 93 if ( dir==0 ) return 0; 94 if ( dir->magicnum!=MAGICNUM_OPENDIR ) return 0; 90 95 de = readdir( dir->dh ); 91 96 -
branches/reyalp-flt/core/modules.c
r1494 r1512 30 30 #endif 31 31 32 // This is to minimize sharing sym to use this lib in other modules 32 33 struct librawop_sym librawop; 33 34 … … 243 244 } 244 245 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 253 static int module_dng_semaphore; 254 255 struct libdng_sym libdng; 256 249 257 #if DNG_SUPPORT 250 convert_dng_to_chdk_raw(fn); 251 #endif 252 } 258 static 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 285 void 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 301 struct 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 //-------------------------------------------------------- 330 int 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 38 38 39 39 40 // MODULE "DNG" 41 //-------------------------- 42 #include "dng.h" 40 43 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 49 struct libdng_sym* module_dng_load(int owner); // 0fail, addr-ok 50 void module_dng_unload(int owner); 51 52 int module_convert_dng_to_chdk_raw(char* fn); // Return: 0-fail, 1-ok 53 43 54 44 55 -
branches/reyalp-flt/core/modules/Makefile
r1494 r1512 18 18 19 19 OBJS=../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 21 21 22 22 … … 27 27 28 28 all: 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 \ 30 30 txtread.flt memview.flt modinsp.flt tetris.flt snake.flt modmenu.flt $(OPT_FLT) 31 31 … … 109 109 $(CC) $(CFLAGS) -o $@ -Wl,--start-group $^ $(LDLIBS) -Wl,--end-group $(LDFLAGS) $(LDOPTS) 110 110 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 111 115 _rawop10.elf: raw_merge10.o 112 116 @echo \-\> $@ -
branches/reyalp-flt/core/raw.c
r1511 r1512 192 192 193 193 void 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; 194 195 #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;196 196 switch (x%8) { 197 197 case 0: addr[0]=(addr[0]&0x3F)|(value<<6); addr[1]=value>>2; break; … … 205 205 } 206 206 #elif CAM_SENSOR_BITS_PER_PIXEL==12 207 unsigned char* addr=(unsigned char*)get_raw_image_addr()+y*RAW_ROWLEN+(x/4)*6;208 207 switch (x%4) { 209 208 case 0: addr[0] = (addr[0]&0x0F) | (unsigned char)(value << 4); addr[1] = (unsigned char)(value >> 4); break; … … 219 218 //------------------------------------------------------------------- 220 219 unsigned 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; 221 221 #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;223 222 switch (x%8) { 224 223 case 0: return ((0x3fc&(((unsigned short)addr[1])<<2)) | (addr[0] >> 6)); … … 232 231 } 233 232 #elif CAM_SENSOR_BITS_PER_PIXEL==12 234 unsigned char* addr=(unsigned char*)get_raw_image_addr()+y*RAW_ROWLEN+(x/4)*6;235 233 switch (x%4) { 236 234 case 0: return ((unsigned short)(addr[1]) << 4) | (addr[0] >> 4); … … 251 249 int i,j; 252 250 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)) { 254 252 if ((conf.bad_pixel_removal==1) || (conf.save_raw && conf.dng_raw)) { // interpolation or DNG saving 255 253 for (i=-2; i<=2; i+=2) -
branches/reyalp-flt/core/raw.h
r1511 r1512 16 16 17 17 //------------------------------------------------------------------- 18 19 #define RAW_ROWLEN ((CAM_RAW_ROWPIX*CAM_SENSOR_BITS_PER_PIXEL)/8)20 21 //-------------------------------------------------------------------22 18 extern int raw_savefile(); 23 19 extern void raw_postprocess(); -
branches/reyalp-flt/core/raw_merge.c
r1494 r1512 37 37 int result; 38 38 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; 42 42 return result; 43 43 … … 64 64 return 0; 65 65 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)) && 68 68 (ffrom=fopen(from, "rb")) && 69 69 (fsub=fopen(sub, "rb")) && … … 72 72 { 73 73 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); 77 77 78 78 #if CAM_MODULE_SENSOR_BITS_PER_PIXEL==10 79 79 80 for(i = 0;i< RAW_CHDK_ROWLEN; i+=10) {80 for(i = 0;i<camera_info.raw_rowlen; i+=10) { 81 81 s =((0x3fc&(((unsigned short)bsub[i+1])<<2)) | (bsub[i+0] >> 6)); 82 82 d =((0x3fc&(((unsigned short)baccum[i+1])<<2)) | (baccum[i+0] >> 6)); … … 133 133 #elif CAM_MODULE_SENSOR_BITS_PER_PIXEL==12 134 134 135 for(i = 0;i< RAW_CHDK_ROWLEN; i+=6) {135 for(i = 0;i<camera_info.raw_rowlen; i+=6) { 136 136 137 137 s=((0xFF0&(((unsigned short)bsub[i+1])<<4)) | (bsub[i+0] >> 4)); … … 164 164 #endif 165 165 166 fwrite(baccum,1, RAW_CHDK_ROWLEN,fdest);166 fwrite(baccum,1,camera_info.raw_rowlen,fdest); 167 167 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); 169 169 } 170 170 } … … 189 189 int raw_merge_start(int action){ 190 190 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; 192 192 avail=GetFreeCardSpaceKb()>>10; 193 193 if (avail<req) { … … 198 198 raw_action=action; 199 199 raw_count=0; 200 row=malloc( CAM_CHDK_RAW_ROWPIX*sizeof(unsigned short));200 row=malloc(camera_info.raw_rows*sizeof(unsigned short)); 201 201 if (!row) 202 202 return 0; 203 rawrow=malloc( RAW_CHDK_ROWLEN);203 rawrow=malloc(camera_info.raw_rowlen); 204 204 if (!rawrow) { 205 205 free(row); … … 230 230 fbrawout=fopen(TEMP_FILE_NAME_1,"w+b"); 231 231 if (fbrawout){ 232 fread(rawrow, 1, RAW_CHDK_ROWLEN, fcraw);232 fread(rawrow, 1, camera_info.raw_rowlen, fcraw); 233 233 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); 235 235 else 236 for (i=0;i< CAM_CHDK_RAW_ROWPIX;i++)236 for (i=0;i<camera_info.raw_rows;i++) 237 237 row[i]=0; 238 238 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++){ 240 240 241 241 #if CAM_MODULE_SENSOR_BITS_PER_PIXEL==10 242 242 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){ 244 244 row[i+0]+=((0x3fc&(((unsigned short)rawrow[src+1])<<2)) | (rawrow[src+0] >> 6)); 245 245 row[i+1]+=((0x3f0&(((unsigned short)rawrow[src+0])<<4)) | (rawrow[src+3] >> 4)); … … 254 254 #elif CAM_MODULE_SENSOR_BITS_PER_PIXEL==12 255 255 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){ 257 257 row[i+0]+=((0xFF0&(((unsigned short)rawrow[src+1])<<4)) | (rawrow[src+0] >> 4)); 258 258 row[i+1]+=((0xF00&(((unsigned short)rawrow[src+0])<<8)) | (rawrow[src+3] )); … … 265 265 #endif 266 266 267 fwrite(row, 1, CAM_CHDK_RAW_ROWPIX*sizeof(unsigned short), fbrawout);267 fwrite(row, 1, camera_info.raw_rows*sizeof(unsigned short), fbrawout); 268 268 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); 270 270 else 271 for (i=0;i< CAM_CHDK_RAW_ROWPIX;i++)271 for (i=0;i<camera_info.raw_rows;i++) 272 272 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); 277 277 } 278 278 } … … 309 309 fcraw=fopen(namebuf,"w+b"); 310 310 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++) { 314 314 if (raw_action==RAW_OPERATION_AVERAGE) 315 315 row[i]/=raw_count; 316 316 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); 319 319 else 320 320 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; 323 323 } 324 324 } 325 325 #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) { 327 327 rawrow[src+0]=(row[i+0]<<6)|(row[i+1]>>4); 328 328 rawrow[src+1]=(row[i+0]>>2); … … 337 337 } 338 338 #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){ 340 340 rawrow[src+0]=(row[i+0]<<4)|(row[i+1]>>8); 341 341 rawrow[src+1]=(row[i+0]>>4); … … 349 349 #endif 350 350 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); 356 356 } 357 357 } -
branches/reyalp-flt/core/shot_histogram.c
r720 r1512 55 55 memset(shot_histogram,0,SHOT_HISTOGRAM_SIZE); 56 56 57 marginstep= ( CAM_RAW_ROWPIX- 2 * SHOT_HISTOGRAM_MARGIN)/10;57 marginstep= (camera_info.raw_rowpix - 2 * SHOT_HISTOGRAM_MARGIN)/10; 58 58 59 59 // In future, support definition of a sort of "spot metering" 60 60 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; 62 62 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; 64 64 65 65 //x0 = SHOT_HISTOGRAM_MARGIN ; 66 //x1 = CAM_RAW_ROWPIX- SHOT_HISTOGRAM_MARGIN ;66 //x1 = camera_info.raw_rowpix - SHOT_HISTOGRAM_MARGIN ; 67 67 //y0 = SHOT_HISTOGRAM_MARGIN; 68 //y1 = CAM_RAW_ROWS- SHOT_HISTOGRAM_MARGIN;68 //y1 = camera_info.raw_rows - SHOT_HISTOGRAM_MARGIN; 69 69 70 70 -
branches/reyalp-flt/include/camera.h
r1493 r1512 145 145 #undef DNG_EXT_FROM // Extension in the cameras known extensions to replace with .DNG to allow DNG 146 146 // 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 DNG148 // IXUS 310 HS bad pixels tend to be grouped into vertical lines of 1-4 pixels149 // This reduces the file size by approx 45%150 147 151 148 #undef CAM_DNG_LENS_INFO // Define this to include camera lens information in DNG files … … 217 214 #endif 218 215 216 //========================================================== 217 // Data Structure to store camera specific information 218 // Used by modules to ensure module code is platform independent 219 220 typedef 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 254 extern _cam_info camera_info; 255 256 //========================================================== 257 219 258 #endif /* CAMERA_H */ -
branches/reyalp-flt/include/stdlib_unified.h
r1498 r1512 39 39 // This is directory handler. 40 40 typedef struct { 41 int magicnum; // to safe second try to close 41 42 void* dh; 42 43 struct STD_dirent de; -
branches/reyalp-flt/platform/g12/platform_camera.h
r1511 r1512 56 56 // camera name 57 57 #define PARAM_CAMERA_NAME 4 // parameter number for GetParameterData 58 #define PARAM_DISPLAY_MODE1 59 // param number for LCD display mode when camera in playback59 #define PARAM_DISPLAY_MODE2 62 // param number for LCD display mode when camera in record view hold mode60 58 #define PARAM_DISPLAY_MODE1 59 // param number for LCD display mode when camera in playback 61 59 #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 70 70 #define PARAM_DISPLAY_MODE1 60 // param number for LCD display mode when camera in playback 71 71 #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 playback73 #define PARAM_DISPLAY_MODE2 64 // param number for LCD display mode when camera in record view hold mode74 72 #undef CAM_SENSOR_BITS_PER_PIXEL 75 73 #define CAM_SENSOR_BITS_PER_PIXEL 12 … … 118 116 #define CAM_DISABLE_RAW_IN_LOW_LIGHT_MODE 1 // For cameras with 'low light' mode that does now work with raw define this 119 117 120 #define DNG_VERT_RLE_BADPIXELS 1 // Enable vertical run length compression of bad pixels, reduces badpixel.bin file size by approx 45%121 122 118 #define CAM_LOAD_CUSTOM_COLORS 1 // Enable loading CHDK colors into the camera palette memory/hardware 123 119 #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.