Changeset 1806


Ignore:
Timestamp:
04/13/12 23:54:11 (14 months ago)
Author:
philmoz
Message:

Fix date/time field in DNG files (thx new123456 & reyalp)
http://chdk.setepontos.com/index.php?topic=7958.msg84174#msg84174
http://chdk.setepontos.com/index.php?topic=7952.msg84059#msg84059

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/release-1_0/core/dng.c

    r1803 r1806  
    6868const int cam_Resolution[]={180,1}; 
    6969int cam_AsShotNeutral[]={1000,1000,1000,1000,1000,1000}; 
     70static char cam_datetime[20]    = "";                   // DateTimeOriginal 
    7071 
    7172// warning: according to TIFF format specification, elements must be sorted by tag value in ascending order! 
    7273 
    7374struct dir_entry IFD0[]={ 
    74  {0xFE,   T_LONG,      1,  1},       // NewSubFileType: Preview Image 
    75  {0x100,  T_LONG,      1,  DNG_TH_WIDTH},   // ImageWidth 
    76  {0x101,  T_LONG,      1,  DNG_TH_HEIGHT},   // ImageLength 
    77  {0x102,  T_SHORT,     3,  (int)cam_PreviewBitsPerSample},   // BitsPerSample: 8,8,8 
    78  {0x103,  T_SHORT,     1,  1},   // Compression: Uncompressed 
    79  {0x106,  T_SHORT,     1,  2}, //PhotometricInterpretation: RGB 
    80  {0x10E,  T_ASCII,     1,  0}, // ImageDescription 
    81  {0x10F,  T_ASCII,     sizeof(CAM_MAKE),  (int)CAM_MAKE}, // Make 
    82  {0x110,  T_ASCII,     32, (int)cam_name}, //Model: Filled at header generation. 
    83  {0x111,  T_LONG,      1,  0}, //StripOffsets: Offset 
    84  {0x112,  T_SHORT,     1,  1}, //Orientation: 1 - 0th row is top, 0th column is left 
    85  {0x115,  T_SHORT,     1,  3}, // SamplesPerPixel: 3 
    86  {0x116,  T_SHORT,     1,  DNG_TH_HEIGHT}, //RowsPerStrip 
    87  {0x117,  T_LONG,      1,  DNG_TH_WIDTH*DNG_TH_HEIGHT*3}, // StripByteCounts = preview size 
    88  {0x11C,  T_SHORT,     1,  1}, // PlanarConfiguration: 1 
    89  {0x131,  T_ASCII,     sizeof(cam_chdk_ver),  (int)cam_chdk_ver}, //Software 
    90  {0x132,  T_ASCII,     20, 0}, // DateTime 
    91  {0x14A,  T_LONG,      1,  0}, //SubIFDs offset 
    92  {0x8298, T_ASCII,     1,  0}, // Copyright 
    93  {0x8769, T_LONG,      1,  0}, //EXIF_IFD offset 
     75 {0xFE,   T_LONG,      1,  1},                              // NewSubFileType: Preview Image 
     76 {0x100,  T_LONG,      1,  DNG_TH_WIDTH},                   // ImageWidth 
     77 {0x101,  T_LONG,      1,  DNG_TH_HEIGHT},                  // ImageLength 
     78 {0x102,  T_SHORT,     3,  (int)cam_PreviewBitsPerSample},  // BitsPerSample: 8,8,8 
     79 {0x103,  T_SHORT,     1,  1},                              // Compression: Uncompressed 
     80 {0x106,  T_SHORT,     1,  2},                              //PhotometricInterpretation: RGB 
     81 {0x10E,  T_ASCII,     1,  0},                              // ImageDescription 
     82 {0x10F,  T_ASCII,     sizeof(CAM_MAKE),  (int)CAM_MAKE},   // Make 
     83 {0x110,  T_ASCII,     32, (int)cam_name},                  //Model: Filled at header generation. 
     84 {0x111,  T_LONG,      1,  0},                              //StripOffsets: Offset 
     85 {0x112,  T_SHORT,     1,  1},                              //Orientation: 1 - 0th row is top, 0th column is left 
     86 {0x115,  T_SHORT,     1,  3},                              // SamplesPerPixel: 3 
     87 {0x116,  T_SHORT,     1,  DNG_TH_HEIGHT},                  //RowsPerStrip 
     88 {0x117,  T_LONG,      1,  DNG_TH_WIDTH*DNG_TH_HEIGHT*3},   // StripByteCounts = preview size 
     89 {0x11C,  T_SHORT,     1,  1},                              // PlanarConfiguration: 1 
     90 {0x131,  T_ASCII,     sizeof(cam_chdk_ver), (int)cam_chdk_ver}, //Software 
     91 {0x132,  T_ASCII,     20, (int)cam_datetime},              // DateTime 
     92 {0x14A,  T_LONG,      1,  0},                              //SubIFDs offset 
     93 {0x8298, T_ASCII,     1,  0},                              // Copyright 
     94 {0x8769, T_LONG,      1,  0},                              //EXIF_IFD offset 
    9495#if defined(CAM_HAS_GPS) 
    95  {0x8825, T_LONG,      1,  0}, //GPS_IFD offset 
    96 #endif 
    97  {0x9216, T_BYTE,      4,  0x00000001},  // TIFF/EPStandardID: 1.0.0.0 
    98  {0xC612, T_BYTE,      4,  0x00000101}, //DNGVersion: 1.1.0.0 
    99  {0xC614, T_ASCII,     32, (int)cam_name}, //UniqueCameraModel. Filled at header generation. 
     96 {0x8825, T_LONG,      1,  0},                              //GPS_IFD offset 
     97#endif 
     98 {0x9216, T_BYTE,      4,  0x00000001},                     // TIFF/EPStandardID: 1.0.0.0 
     99 {0xC612, T_BYTE,      4,  0x00000101},                     //DNGVersion: 1.1.0.0 
     100 {0xC614, T_ASCII,     32, (int)cam_name},                  //UniqueCameraModel. Filled at header generation. 
    100101 {0xC621, T_SRATIONAL, 9,  (int)cam_ColorMatrix1}, 
    101102 {0xC627, T_RATIONAL,  3,  (int)cam_AnalogBalance}, 
     
    141142static int cam_shutter[2]       = { 0, 1000000 };       // Shutter speed 
    142143static int cam_aperture[2]      = { 0, 10 };            // Aperture 
    143 static char cam_datetime[20]    = "";                   // DateTimeOriginal 
    144144static int cam_apex_shutter[2]  = { 0, 96 };            // Shutter speed in APEX units 
    145145static int cam_apex_aperture[2] = { 0, 96 };            // Aperture in APEX units 
     
    256256     case 0x110 :                                                                                       // CameraName 
    257257     case 0xC614: IFD_LIST[j].entry[i].count = strlen((char*)IFD_LIST[j].entry[i].offset) + 1; break;   // UniqueCameraModel 
    258      case 0x132 : 
    259258     case 0x8827: IFD_LIST[j].entry[i].offset=exif_data.iso; break;//ISOSpeedRatings 
    260259     case 0x8822: IFD_LIST[j].entry[i].offset=get_exp_program_for_exif(exif_data.exp_program); break;//ExposureProgram 
Note: See TracChangeset for help on using the changeset viewer.