CHDK_DE Vorschauversion  Trunk Rev. 6014
 Alle Datenstrukturen Dateien Funktionen Variablen Typdefinitionen Aufzählungen Aufzählungswerte Makrodefinitionen
dng.c-Dateireferenz
#include "camera_info.h"
#include "modes.h"
#include "debug_led.h"
#include "clock.h"
#include "properties.h"
#include "shooting.h"
#include "conf.h"
#include "console.h"
#include "raw.h"
#include "action_stack.h"
#include "gui.h"
#include "gui_mbox.h"
#include "gui_lang.h"
#include "gps.h"
#include "math.h"
#include "cache.h"
#include "task.h"
#include "cachebit.h"
#include "remotecap.h"
#include "time.h"
#include "dng.h"
#include "module_def.h"
+ Include-Abhängigkeitsdiagramm für dng.c:

gehe zum Quellcode dieser Datei

Datenstrukturen

struct  dir_entry
 
struct  t_data_for_exif
 
struct  ifd_entry
 

Makrodefinitionen

#define DNG_TH_WIDTH   128
 
#define DNG_TH_HEIGHT   96
 
#define DNG_TH_BYTES   (DNG_TH_WIDTH*DNG_TH_HEIGHT*3)
 
#define T_EOL   0
 
#define T_BYTE   1
 
#define T_ASCII   2
 
#define T_SHORT   3
 
#define T_LONG   4
 
#define T_RATIONAL   5
 
#define T_SBYTE   6
 
#define T_UNDEFINED   7
 
#define T_SSHORT   8
 
#define T_SLONG   9
 
#define T_SRATIONAL   10
 
#define T_FLOAT   11
 
#define T_DOUBLE   12
 
#define T_PTR   0x100
 
#define T_SKIP   0x200
 
#define BE(v)   ((v&0x000000FF)<<24)|((v&0x0000FF00)<<8)|((v&0x00FF0000)>>8)|((v&0xFF000000)>>24)
 
#define BADPIX_CFA_INDEX   6
 
#define CAMERA_NAME_TAG   0x110
 
#define THUMB_DATA_TAG   0x111
 
#define ORIENTATION_TAG   0x112
 
#define CHDK_VER_TAG   0x131
 
#define ARTIST_NAME_TAG   0x13B
 
#define SUBIFDS_TAG   0x14A
 
#define COPYRIGHT_TAG   0x8298
 
#define EXIF_IFD_TAG   0x8769
 
#define GPS_IFD_TAG   0x8825
 
#define DNG_VERSION_TAG   0xC612
 
#define UNIQUE_CAMERA_MODEL_TAG   0xC614
 
#define COLOR_MATRIX2_TAG   0xc622
 
#define CALIBRATION1_TAG   0xc623
 
#define CALIBRATION2_TAG   0xc624
 
#define ILLUMINANT2_TAG   0xc65b
 
#define FORWARD_MATRIX1_TAG   0xc714
 
#define FORWARD_MATRIX2_TAG   0xc715
 
#define CAM_MAKE   "Canon"
 
#define RAW_DATA_TAG   0x111
 
#define BADPIXEL_OPCODE_TAG   0xC740
 
#define EXPOSURE_PROGRAM_TAG   0x8822
 
#define METERING_MODE_TAG   0x9207
 
#define FLASH_MODE_TAG   0x9209
 
#define SSTIME_TAG   0x9290
 
#define SSTIME_ORIG_TAG   0x9291
 
#define IFD_0   1
 
#define IFD_1   2
 
#define IFD_EXIF   3
 
#define IFD_GPS   4
 
#define IFD_SKIP   0x200
 
#define IFD_TYPE_MASK   0xF
 
#define TIFF_HDR_SIZE   (8)
 
#define BUF_SIZE   (32768)
 
#define INIT_BADPIXEL_COUNT   -1
 
#define INIT_BADPIXEL_FILE   -2
 
#define PATH_BADPIXEL_BIN   "A/CHDK/badpixel.bin"
 
#define PATH_BAD_TMP_BIN   "A/CHDK/bad_tmp.bin"
 
#define RB_STAGE_DONE   0
 
#define RB_STAGE_INIT   1
 
#define RB_STAGE_REVERSING   2
 
#define RB_STAGE_DEREVERSING   3
 
#define DNG_REV_CHUNK_SIZE   (512*1024)
 
#define DNG_END_CHUNK_SIZE   (512*1024)
 
#define DNG_END_NUM_CHUNKS   (3)
 

Funktionen

void reverse_bytes_order2 (char *from, char *to, int count)
 
unsigned short get_exp_program_for_exif (int exp_program)
 
unsigned short get_orientation_for_exif (short orientation)
 
unsigned short get_flash_mode_for_exif (short mode, short fired)
 
unsigned short get_metering_mode_for_exif (short metering_mode)
 
int get_type_size (int type)
 
static ifd_entryget_ifd (int type)
 
static dir_entryget_tag (int ifd, int tag)
 
void add_to_buf (void *var, int size)
 
void add_val_to_buf (int val, int size)
 
static void process_ifd_list (void(*f)(ifd_entry *))
 
static void process_entries (ifd_entry *ifd, void(*f)(ifd_entry *, dir_entry *))
 
static void inc_ifd_count (ifd_entry *ifd, __attribute__((unused)) dir_entry *e)
 
static void calc_ifd_count (ifd_entry *ifd)
 
static void inc_raw_offset (__attribute__((unused)) ifd_entry *ifd, dir_entry *e)
 
static void calc_raw_offset (ifd_entry *ifd)
 
static void calc_extra_offset (ifd_entry *ifd)
 
static void add_entry_to_buffer (__attribute__((unused)) ifd_entry *ifd, dir_entry *e)
 
static void add_ifd_to_buffer (ifd_entry *ifd)
 
static void add_entry_extra_data_to_buffer (__attribute__((unused)) ifd_entry *ifd, dir_entry *e)
 
static void add_extra_data_to_buffer (ifd_entry *ifd)
 
void create_dng_header (int ver1_1, int minimal)
 
void free_dng_header (void)
 
int pow_calc_2 (int mult, int x, int x_div, double y, int y_div)
 
int pow_calc (int mult, int x, int x_div, int y, int y_div)
 
void capture_data_for_exif (void)
 
static int convert_dng_to_chdk_raw (char *fn)
 
static void load_dng_to_rawbuffer (char *fn, char *rawadr)
 
void create_thumbnail ()
 
int raw_init_badpixel_bin ()
 
void unload_bad_pixels_list_b (void)
 
void load_bad_pixels_list_b (char *filename)
 
void patch_bad_pixels_b (void)
 
int badpixel_list_loaded_b (void)
 
static int action_stack_BADPIX_S3 ()
 
static int action_stack_BADPIX_S2 ()
 
static int action_stack_BADPIX_S1 ()
 
static int action_stack_BADPIX_START ()
 
void create_badpixel_bin ()
 
void reverse_bytes_task ()
 
int write_dng (char *rawadr, char *altrawadr)
 
void create_dng_header_for_ptp (ptp_data_chunk *pdc)
 
void free_dng_header_for_ptp ()
 
int _module_unloader ()
 
int _module_can_unload ()
 

Variablen

static int running = 0
 
const int cam_BaselineNoise [] = {1,1}
 
const int cam_BaselineSharpness [] = {4,3}
 
const int cam_LinearResponseLimit [] = {1,1}
 
const int cam_AnalogBalance [] = {1,1,1,1,1,1}
 
static char cam_name [32] = ""
 
static char artist_name [64] = ""
 
static char copyright [64] = ""
 
const short cam_PreviewBitsPerSample [] = {8,8,8}
 
const int cam_Resolution [] = {180,1}
 
static int cam_AsShotNeutral [] = {1000,1000,1000,1000,1000,1000}
 
static char cam_datetime [20] = ""
 
static char cam_subsectime [4] = ""
 
static int cam_shutter [2] = { 0, 1000000 }
 
static int cam_aperture [2] = { 0, 10 }
 
static int cam_apex_shutter [2] = { 0, 96 }
 
static int cam_apex_aperture [2] = { 0, 96 }
 
static int cam_exp_bias [2] = { 0, 96 }
 
static int cam_max_av [2] = { 0, 96 }
 
static int cam_focal_length [2] = { 0, 1000 }
 
static int cam_subject_distance [2] = { 0, 1000 }
 
static struct t_data_for_exif exif_data
 
static unsigned int badpixel_opcode []
 
dir_entry ifd0 []
 
static int crop_origin [2]
 
static int crop_size [2]
 
static int active_area [4]
 
dir_entry ifd1 []
 
dir_entry exif_ifd []
 
tGPS gps_data
 
dir_entry gpd_ifd []
 
ifd_entry ifd_list []
 
char * dng_header_buf = 0
 
int dng_header_buf_size
 
int dng_header_buf_offset
 
char * thumbnail_buf = 0
 
static int raw_offset
 
static int extra_offset
 
static const unsigned char gamma [256]
 
int init_badpixel_bin_flag
 
short * binary_list =NULL
 
int binary_count =-1
 
static int badpix_cnt1
 
struct {
   char *   src
 
   char *   dst
 
   char *   end
 
   char *   reversed
 
   char *   written
 
   int   stage
 
rb_state
 
libdng_sym _libdng
 
ModuleInfo _module_info
 

Makro-Dokumentation

#define ARTIST_NAME_TAG   0x13B

Definiert in Zeile 125 der Datei dng.c.

#define BADPIX_CFA_INDEX   6

Definiert in Zeile 102 der Datei dng.c.

#define BADPIXEL_OPCODE_TAG   0xC740

Definiert in Zeile 188 der Datei dng.c.

#define BE (   v)    ((v&0x000000FF)<<24)|((v&0x0000FF00)<<8)|((v&0x00FF0000)>>8)|((v&0xFF000000)>>24)

Definiert in Zeile 100 der Datei dng.c.

#define BUF_SIZE   (32768)
#define CALIBRATION1_TAG   0xc623

Definiert in Zeile 133 der Datei dng.c.

#define CALIBRATION2_TAG   0xc624

Definiert in Zeile 134 der Datei dng.c.

#define CAM_MAKE   "Canon"

Definiert in Zeile 139 der Datei dng.c.

#define CAMERA_NAME_TAG   0x110

Definiert in Zeile 121 der Datei dng.c.

#define CHDK_VER_TAG   0x131

Definiert in Zeile 124 der Datei dng.c.

#define COLOR_MATRIX2_TAG   0xc622

Definiert in Zeile 132 der Datei dng.c.

#define COPYRIGHT_TAG   0x8298

Definiert in Zeile 127 der Datei dng.c.

#define DNG_END_CHUNK_SIZE   (512*1024)

Definiert in Zeile 1198 der Datei dng.c.

#define DNG_END_NUM_CHUNKS   (3)

Definiert in Zeile 1203 der Datei dng.c.

#define DNG_REV_CHUNK_SIZE   (512*1024)

Definiert in Zeile 1188 der Datei dng.c.

#define DNG_TH_BYTES   (DNG_TH_WIDTH*DNG_TH_HEIGHT*3)

Definiert in Zeile 31 der Datei dng.c.

#define DNG_TH_HEIGHT   96

Definiert in Zeile 30 der Datei dng.c.

#define DNG_TH_WIDTH   128

Definiert in Zeile 29 der Datei dng.c.

#define DNG_VERSION_TAG   0xC612

Definiert in Zeile 130 der Datei dng.c.

#define EXIF_IFD_TAG   0x8769

Definiert in Zeile 128 der Datei dng.c.

#define EXPOSURE_PROGRAM_TAG   0x8822

Definiert in Zeile 222 der Datei dng.c.

#define FLASH_MODE_TAG   0x9209

Definiert in Zeile 224 der Datei dng.c.

#define FORWARD_MATRIX1_TAG   0xc714

Definiert in Zeile 136 der Datei dng.c.

#define FORWARD_MATRIX2_TAG   0xc715

Definiert in Zeile 137 der Datei dng.c.

#define GPS_IFD_TAG   0x8825

Definiert in Zeile 129 der Datei dng.c.

#define IFD_0   1

Definiert in Zeile 288 der Datei dng.c.

#define IFD_1   2

Definiert in Zeile 289 der Datei dng.c.

#define IFD_EXIF   3

Definiert in Zeile 290 der Datei dng.c.

#define IFD_GPS   4

Definiert in Zeile 291 der Datei dng.c.

#define IFD_SKIP   0x200

Definiert in Zeile 292 der Datei dng.c.

#define IFD_TYPE_MASK   0xF

Definiert in Zeile 293 der Datei dng.c.

#define ILLUMINANT2_TAG   0xc65b

Definiert in Zeile 135 der Datei dng.c.

#define INIT_BADPIXEL_COUNT   -1

Definiert in Zeile 940 der Datei dng.c.

#define INIT_BADPIXEL_FILE   -2

Definiert in Zeile 941 der Datei dng.c.

#define METERING_MODE_TAG   0x9207

Definiert in Zeile 223 der Datei dng.c.

#define ORIENTATION_TAG   0x112

Definiert in Zeile 123 der Datei dng.c.

#define PATH_BAD_TMP_BIN   "A/CHDK/bad_tmp.bin"

Definiert in Zeile 944 der Datei dng.c.

#define PATH_BADPIXEL_BIN   "A/CHDK/badpixel.bin"

Definiert in Zeile 943 der Datei dng.c.

#define RAW_DATA_TAG   0x111

Definiert in Zeile 187 der Datei dng.c.

#define RB_STAGE_DEREVERSING   3

Definiert in Zeile 1178 der Datei dng.c.

#define RB_STAGE_DONE   0

Definiert in Zeile 1175 der Datei dng.c.

#define RB_STAGE_INIT   1

Definiert in Zeile 1176 der Datei dng.c.

#define RB_STAGE_REVERSING   2

Definiert in Zeile 1177 der Datei dng.c.

#define SSTIME_ORIG_TAG   0x9291

Definiert in Zeile 226 der Datei dng.c.

#define SSTIME_TAG   0x9290

Definiert in Zeile 225 der Datei dng.c.

#define SUBIFDS_TAG   0x14A

Definiert in Zeile 126 der Datei dng.c.

#define T_ASCII   2

Definiert in Zeile 48 der Datei dng.c.

#define T_BYTE   1

Definiert in Zeile 47 der Datei dng.c.

#define T_DOUBLE   12

Definiert in Zeile 58 der Datei dng.c.

#define T_EOL   0

Definiert in Zeile 46 der Datei dng.c.

#define T_FLOAT   11

Definiert in Zeile 57 der Datei dng.c.

#define T_LONG   4

Definiert in Zeile 50 der Datei dng.c.

#define T_PTR   0x100

Definiert in Zeile 59 der Datei dng.c.

#define T_RATIONAL   5

Definiert in Zeile 51 der Datei dng.c.

#define T_SBYTE   6

Definiert in Zeile 52 der Datei dng.c.

#define T_SHORT   3

Definiert in Zeile 49 der Datei dng.c.

#define T_SKIP   0x200

Definiert in Zeile 60 der Datei dng.c.

#define T_SLONG   9

Definiert in Zeile 55 der Datei dng.c.

#define T_SRATIONAL   10

Definiert in Zeile 56 der Datei dng.c.

#define T_SSHORT   8

Definiert in Zeile 54 der Datei dng.c.

#define T_UNDEFINED   7

Definiert in Zeile 53 der Datei dng.c.

#define THUMB_DATA_TAG   0x111

Definiert in Zeile 122 der Datei dng.c.

#define TIFF_HDR_SIZE   (8)

Definiert in Zeile 339 der Datei dng.c.

#define UNIQUE_CAMERA_MODEL_TAG   0xC614

Definiert in Zeile 131 der Datei dng.c.

Dokumentation der Funktionen

int _module_can_unload ( )

Definiert in Zeile 1377 der Datei dng.c.

1378 {
1379  return (running == 0) && (remotecap_using_dng_module() == 0) && ((conf.save_raw == 0) || (conf.dng_raw == 0));
1380 }
int _module_unloader ( )

Definiert in Zeile 1370 der Datei dng.c.

1371 {
1373  free_dng_header();
1374  return 0;
1375 }
static int action_stack_BADPIX_S1 ( )
static

Definiert in Zeile 1117 der Datei dng.c.

1118 {
1119  // Process bad pixel generation actions
1120 
1121  action_pop_func(0);
1122 
1123  // Count bad pixels from previous shot
1127 
1128  // Push stack items for next phase (note reversed execution order)
1130  action_push_shoot(1);
1131 
1132  return 1;
1133 }
static int action_stack_BADPIX_S2 ( )
static

Definiert in Zeile 1083 der Datei dng.c.

1084 {
1085  // Process bad pixel generation actions
1086 
1087  action_pop_func(0);
1088 
1089  console_clear();
1091  {
1092  // TODO script asked confirmation first
1093  // should sanity check bad pixel count at least,
1094  // wrong buffer address could make badpixel bigger than available mem
1095  char msg[32];
1096  console_add_line("badpixel.bin created.");
1097  sprintf(msg, "Bad pixel count: %d", badpix_cnt1);
1098  console_add_line(msg);
1099  remove(PATH_BADPIXEL_BIN);
1101  }
1102  else
1103  {
1104  console_add_line("badpixel.bin failed.");
1105  console_add_line("Please try again.");
1106  }
1108  remove(PATH_BAD_TMP_BIN);
1109 
1110  // Delay to give user time to read messages
1112  action_push_delay(3000);
1113 
1114  return 1;
1115 }
static int action_stack_BADPIX_S3 ( )
static

Definiert in Zeile 1076 der Datei dng.c.

1077 {
1078  action_pop_func(0);
1079  running = 0;
1080  return 1;
1081 }
static int action_stack_BADPIX_START ( )
static

Definiert in Zeile 1135 der Datei dng.c.

1136 {
1137  // Process bad pixel generation actions
1138 
1139  action_pop_func(0);
1140 
1141  // Notify user
1142  console_clear();
1143  console_add_line("Wait please... ");
1144  console_add_line("This takes a few seconds,");
1145  console_add_line("don't panic!");
1146 
1148 
1150 
1151  // Push stack items for next phase (note reversed execution order)
1153  action_push_shoot(1);
1154  action_push_delay(3000);
1155 
1156  return 1;
1157 }
static void add_entry_extra_data_to_buffer ( __attribute__((unused)) ifd_entry ifd,
dir_entry e 
)
static

Definiert in Zeile 461 der Datei dng.c.

462 {
463  int size_ext = get_type_size(e->type) * e->count;
464  if (size_ext > 4)
465  {
466  add_to_buf((void*)e->offset, size_ext);
467  if (size_ext&1) add_val_to_buf(0, 1);
468  }
469 }
static void add_entry_to_buffer ( __attribute__((unused)) ifd_entry ifd,
dir_entry e 
)
static

Definiert in Zeile 428 der Datei dng.c.

429 {
430  add_val_to_buf(e->tag, sizeof(short));
431  add_val_to_buf(e->type & 0xFF, sizeof(short));
432  add_val_to_buf(e->count, sizeof(int));
433  int size_ext = get_type_size(e->type) * e->count;
434  if (size_ext <= 4)
435  {
436  if (e->type & T_PTR)
437  {
438  add_to_buf((void*)e->offset, sizeof(int));
439  }
440  else
441  {
442  add_val_to_buf(e->offset, sizeof(int));
443  }
444  }
445  else
446  {
447  add_val_to_buf(extra_offset, sizeof(int));
448  extra_offset += size_ext + (size_ext&1);
449  }
450 }
static void add_extra_data_to_buffer ( ifd_entry ifd)
static

Definiert in Zeile 471 der Datei dng.c.

472 {
474 }
static void add_ifd_to_buffer ( ifd_entry ifd)
static

Definiert in Zeile 452 der Datei dng.c.

453 {
454  add_val_to_buf(ifd->count, sizeof(short)); // Add count of entries for this IFD
455  process_entries(ifd, add_entry_to_buffer); // Add all entries
456  add_val_to_buf(0, sizeof(int)); // Terminate entry list
457 }
void add_to_buf ( void *  var,
int  size 
)

Definiert in Zeile 349 der Datei dng.c.

350 {
352  dng_header_buf_offset += size;
353 }
void add_val_to_buf ( int  val,
int  size 
)

Definiert in Zeile 356 der Datei dng.c.

357 {
358  add_to_buf(&val,size);
359 }
int badpixel_list_loaded_b ( void  )

Definiert in Zeile 1067 der Datei dng.c.

1068 {
1069  return (binary_count >= 0) ? 1 : 0;
1070 }
static void calc_extra_offset ( ifd_entry ifd)
static

Definiert in Zeile 421 der Datei dng.c.

422 {
423  extra_offset += 6 + ifd->count * 12; // IFD header+footer
424 }
static void calc_ifd_count ( ifd_entry ifd)
static

Definiert in Zeile 394 der Datei dng.c.

395 {
396  ifd->count = 0;
398 }
static void calc_raw_offset ( ifd_entry ifd)
static

Definiert in Zeile 411 der Datei dng.c.

412 {
413  raw_offset+=6; // IFD header+footer
414  process_entries(ifd, inc_raw_offset); // Add size of each entry to raw_offset
415 }
void capture_data_for_exif ( void  )

Definiert in Zeile 721 der Datei dng.c.

722 {
723  short short_prop_val;
724  time_t datetime;
725  long subsectime;
726  struct tm *ttm;
727  int wb[3];
728 
730 
731  // Shutter speed tags
732  get_property_case(camera_info.props.tv, &short_prop_val, sizeof(short_prop_val));
733  cam_shutter[0] = pow_calc( 1000000, 2, 1, -short_prop_val, 96);
734  cam_apex_shutter[0] = short_prop_val;
735 
736  // Date & time tag (note - uses shutter speed from 'short_prop_val' code above)
738  {
739  // milliseconds component of shutter_open_time
741  // shutter closing time
742  datetime = camera_info.state.shutter_open_time + ((cam_shutter[0] + (subsectime * 1000)) / 1000000);
744  }
745  else
746  {
747  datetime = time(NULL);
748  // milliseconds component of datetime
749  subsectime = (get_tick_count() - camera_info.tick_count_offset) % 1000;
750  }
751  ttm = localtime(&datetime);
752  sprintf(cam_datetime, "%04d:%02d:%02d %02d:%02d:%02d", ttm->tm_year+1900, ttm->tm_mon+1, ttm->tm_mday, ttm->tm_hour, ttm->tm_min, ttm->tm_sec);
753  sprintf(cam_subsectime, "%02d", subsectime/10); // camera tick count is only accurate to 10 msec intervals
754 
755  get_property_case(camera_info.props.av, &short_prop_val, sizeof(short_prop_val));
756  cam_aperture[0] = pow_calc( 10, 2, 1, short_prop_val, 192);
757  cam_apex_aperture[0] = short_prop_val;
758 
759  get_property_case(camera_info.props.min_av, &short_prop_val, sizeof(short_prop_val));
760  cam_max_av[0] = short_prop_val;
761 
762  get_property_case(camera_info.props.ev_correction_2, &short_prop_val, sizeof(short_prop_val));
763  cam_exp_bias[0] = short_prop_val;
764 
766 
768 
771 
780 
781  get_property_case(camera_info.props.wb_adj, &wb, sizeof(wb));
782  cam_AsShotNeutral[1]=wb[1];
783  cam_AsShotNeutral[3]=wb[0];
784  cam_AsShotNeutral[5]=wb[2];
785 }
static int convert_dng_to_chdk_raw ( char *  fn)
static

Definiert in Zeile 789 der Datei dng.c.

790 {
791 #define BUF_SIZE (32768)
792  FILE *dng, *raw;
793  int *buf;
794  unsigned i;
795  struct stat st;
796  struct utimbuf t;
797 
798  if (stat(fn, &st) != 0 || st.st_size<=camera_sensor.raw_size)
799  return 0;
800 
801  running = 1;
802 
803  buf=malloc(BUF_SIZE);
804  if (buf)
805  {
806  started();
807  dng=fopen(fn,"rb");
808  if (dng)
809  {
810  fread(buf, 1, 8, dng);
811  if (buf[0]==0x2A4949 && buf[1]==8)
812  { // chdk dng header
813  i=strlen(fn)-3;
814  if (strncmp(fn+i,"CR",2)==0) strcpy(fn+i,"WAV"); else strcpy(fn+i,"CRW");
815  raw=fopen(fn,"w+b");
816  if (raw){
817  fseek(dng, st.st_size-camera_sensor.raw_size, SEEK_SET); // SEEK_END is not working?
818  for (i=0; i<camera_sensor.raw_size/BUF_SIZE; i++)
819  {
820  fread(buf, 1, BUF_SIZE, dng);
821  reverse_bytes_order2((char*)buf, (char*)buf, BUF_SIZE);
822  fwrite(buf, 1, BUF_SIZE, raw);
823  }
824  fread(buf, 1, camera_sensor.raw_size%BUF_SIZE, dng);
825  reverse_bytes_order2((char*)buf, (char*)buf, camera_sensor.raw_size%BUF_SIZE);
826  fwrite(buf, 1, camera_sensor.raw_size%BUF_SIZE, raw);
827  fclose(raw);
828  t.actime = t.modtime = time(NULL);
829  utime(fn, &t);
830  } // if (raw)
831  } // if chdk dng header
832  fclose(dng);
833  } //if (dng)
834  free(buf);
835  finished();
836  } //if (buf)
837 
838  running = 0;
839 
840  return 1;
841 }
void create_badpixel_bin ( )

Definiert in Zeile 1159 der Datei dng.c.

1160 {
1161  if (!camera_info.state.mode_rec)
1162  {
1164  return;
1165  }
1166 
1167  running = 1;
1168 
1170  // Create an action stack to generate bad pixels - start with action_stack_BADPIX_START func above
1172 }
void create_dng_header ( int  ver1_1,
int  minimal 
)

Definiert in Zeile 482 der Datei dng.c.

483 {
484  int i;
485 
486  // Set version and opcodes
487  if (ver1_1)
488  {
489  // If CHDK is removing bad pixels then set DNG version to 1.1 and remove opcodes
490  get_tag(IFD_0, DNG_VERSION_TAG)->offset = BE(0x01010000);
492  }
493  else
494  {
495  // Set DNG version to 1.3 and add bad pixel opcodes
496  get_tag(IFD_0, DNG_VERSION_TAG)->offset = BE(0x01030000);
498  // Set CFAPattern value
499  switch (camera_sensor.cfa_pattern)
500  {
501  case 0x02010100:
502  badpixel_opcode[BADPIX_CFA_INDEX] = BE(0); // BayerPhase = 0 (top left pixel is red)
503  break;
504  case 0x01020001:
505  badpixel_opcode[BADPIX_CFA_INDEX] = BE(1); // BayerPhase = 1 (top left pixel is green in a green/red row)
506  break;
507  case 0x01000201:
508  badpixel_opcode[BADPIX_CFA_INDEX] = BE(2); // BayerPhase = 2 (top left pixel is green in a green/blue row)
509  break;
510  case 0x00010102:
511  badpixel_opcode[BADPIX_CFA_INDEX] = BE(3); // BayerPhase = 3 (top left pixel is blue)
512  break;
513  }
514  }
515 
516  // Set crop origin, size and active area from user selected 'crop size'
517  switch (conf.dng_crop_size)
518  {
519  case 0: // JPEG
520  default:
521  // Set crop origin & size
524  crop_size[0] = camera_sensor.jpeg.width;
525  crop_size[1] = camera_sensor.jpeg.height;
526  // Re-set active area (in case user has changed setting)
528  break;
529  case 1: // Active Area
530  // Set crop origin & size
531  crop_origin[0] = 0;
532  crop_origin[1] = 0;
535  // Re-set active area (in case user has changed setting)
537  break;
538  case 2: // Full sensor
539  // Set crop origin & size
540  crop_origin[0] = 0;
541  crop_origin[1] = 0;
544  // Re-set active area (in case user has changed setting)
545  active_area[0] = (camera_sensor.active_area.y1 & 1); // In case active area top is an odd value, otherwise CFA pattern will be wrong
546  active_area[1] = 0;
549  break;
550  }
551 
552  // filling EXIF fields
553 
554  if (camera_info.props.gps)
555  {
556  // If camera has GPS get the GPS data
558  }
559  else
560  {
561  // If no GPS then remove the GPS data from the header
563  get_tag(IFD_0, GPS_IFD_TAG)->type |= T_SKIP; // mark entry so it is skipped
564  }
565 
566  // Fix the counts and offsets where needed
567 
574 
579 
580  // Skip color matrix and calibration entries that aren't defined for the camera
582  {
585  }
590 
591  // fixup up IFD count values, exclude skipped entries
593 
594  // calculating offset of RAW data and count of entries for each IFD
597 
598  // creating buffer for writing data
599  if (minimal)
600  {
601  raw_offset = (raw_offset/4+1)*4; // ensure 32 bit aligned
604  }
605  else
606  {
607  raw_offset = (raw_offset/512+1)*512; // exclusively for CHDK fast file writing
610  }
612  if (!dng_header_buf)
613  {
615  return;
616  }
618 
619  // writing offsets for EXIF IFD and RAW data and calculating offset for extra data
620 
621  get_tag(IFD_0, SUBIFDS_TAG)->offset = TIFF_HDR_SIZE + ifd_list[0].count * 12 + 6; // SubIFDs offset
622  get_tag(IFD_0, EXIF_IFD_TAG)->offset = TIFF_HDR_SIZE + (ifd_list[0].count + ifd_list[1].count) * 12 + 6 + 6; // EXIF IFD offset
623  if (camera_info.props.gps)
624  get_tag(IFD_0, GPS_IFD_TAG)->offset = TIFF_HDR_SIZE + (ifd_list[0].count + ifd_list[1].count + ifd_list[2].count) * 12 + 6 + 6 + 6; // GPS IFD offset
625 
626  get_tag(IFD_0, THUMB_DATA_TAG)->offset = raw_offset; //StripOffsets for thumbnail
627  get_tag(IFD_1, RAW_DATA_TAG)->offset = raw_offset + DNG_TH_BYTES; //StripOffsets for main image
628 
631 
632  // TIFF file header
633  add_val_to_buf(0x4949, sizeof(short)); // little endian
634  add_val_to_buf(42, sizeof(short)); // An arbitrary but carefully chosen number that further identifies the file as a TIFF file.
635  add_val_to_buf(TIFF_HDR_SIZE, sizeof(int)); // offset of first IFD
636 
637  // writing IFDs
639 
640  // writing extra data (values for entries that don't fit into 4 bytes)
642 
643  // writing zeros to tail of DNG header (just for fun)
645 }
void create_dng_header_for_ptp ( ptp_data_chunk pdc)

Definiert in Zeile 1348 der Datei dng.c.

1349 {
1350  create_dng_header(0,1);
1351  if (dng_header_buf) {
1352  pdc->address = (unsigned int)dng_header_buf; // cached may be slightly slower, but need to clean otherwise
1353  pdc->length = (unsigned int)dng_header_buf_size;
1354  } else {
1355  pdc->address = 0;
1356  pdc->length = 0;
1357  }
1358 }
void create_thumbnail ( )

Definiert in Zeile 899 der Datei dng.c.

900 {
901  char *buf = thumbnail_buf;
902  int shift = camera_sensor.bits_per_pixel - 8;
903 
904  int x_inc = camera_sensor.jpeg.width / DNG_TH_WIDTH;
905  int y_inc = camera_sensor.jpeg.height / DNG_TH_HEIGHT;
906 
909 
910  int x_off,y_off;
911 
912  // The sensor bayer patterns are:
913  // 0x02010100 0x01000201 0x01020001
914  // R G G B G R
915  // G B R G B G
916  // for the second pattern yadj shifts the thumbnail row down one line
917  // for the third pattern xadj shifts the thumbnail row accross one pixel
918  // these make the patterns the same
919  int yadj = (camera_sensor.cfa_pattern == 0x01000201) ? 1 : 0;
920  int xadj = (camera_sensor.cfa_pattern == 0x01020001) ? 1 : 0;
921 
922  for (y_off=camera_sensor.active_area.y1 + camera_sensor.jpeg.y; y_off<y_end; y_off += y_inc)
923  for (x_off=camera_sensor.active_area.x1 + camera_sensor.jpeg.x; x_off<x_end; x_off += x_inc)
924  {
925  int x = (x_off & 0xFFFFFFFE) + xadj;
926  int y = (y_off & 0xFFFFFFFE) + yadj;
927 
928  *buf++ = gamma[get_raw_pixel(x,y)>>shift]; // red pixel
929  //*buf++ = gamma[6*(get_raw_pixel(x+1,y)>>shift)/10]; // green pixel
930  int g=get_raw_pixel(x+1,y) >> (shift+1);
931  *buf++ = gamma[g+(g>>2)]; // green pixel was (6*g/10), now (g/2 + g/8)
932  *buf++ = gamma[get_raw_pixel(x+1,y+1)>>shift]; // blue pixel
933  }
934 }
void free_dng_header ( void  )

Definiert in Zeile 647 der Datei dng.c.

648 {
649  if (dng_header_buf)
650  {
653  }
654 }
void free_dng_header_for_ptp ( )

Definiert in Zeile 1359 der Datei dng.c.

1360 {
1361  free_dng_header();
1362 }
unsigned short get_exp_program_for_exif ( int  exp_program)

Definiert in Zeile 657 der Datei dng.c.

658 {
659  switch(exp_program)
660  {
661  case MODE_M: return 1;
662  case MODE_P: return 2;
663  case MODE_AV: return 3;
664  case MODE_TV: return 4;
665  default: return 0;
666  }
667 }
unsigned short get_flash_mode_for_exif ( short  mode,
short  fired 
)

Definiert in Zeile 681 der Datei dng.c.

681  {
682  fired&=1;
683  switch(mode)
684  {
685  case 0: return (3<<3)|fired; // auto
686  case 1: return (1<<3)|fired; // on
687  case 2: return (2<<3)|fired; // off
688  default: return fired;
689  }
690 }
static ifd_entry* get_ifd ( int  type)
static

Definiert in Zeile 312 der Datei dng.c.

313 {
314  int i;
315  for (i = 0; ifd_list[i].entry != 0; i++)
316  {
317  if ((ifd_list[i].type & IFD_TYPE_MASK) == type)
318  return &ifd_list[i];
319  }
320  return 0;
321 }
unsigned short get_metering_mode_for_exif ( short  metering_mode)

Definiert in Zeile 692 der Datei dng.c.

693 {
694  switch (metering_mode)
695  {
696  case 0: return 5; // Evaluative
697  case 1: return 3; // Spot
698  case 2: return 2; // CenterWeightedAverage
699  default: return 255; // other
700  }
701 }
unsigned short get_orientation_for_exif ( short  orientation)

Definiert in Zeile 669 der Datei dng.c.

670 {
671  switch(orientation)
672  {
673  case 90: return 6; // Right - Top
674  case 180: return 3; // Bottom - Right
675  case 270: return 8; // Left - Bottom
676  case 0: // Top - Left
677  default : return 1;
678  }
679 }
static dir_entry* get_tag ( int  ifd,
int  tag 
)
static

Definiert in Zeile 324 der Datei dng.c.

325 {
326  ifd_entry* p = get_ifd(ifd);
327  if (p)
328  {
329  int i;
330  for (i=0; p->entry[i].type != T_EOL; i++)
331  {
332  if (p->entry[i].tag == tag)
333  return &p->entry[i];
334  }
335  }
336  return 0;
337 }
int get_type_size ( int  type)

Definiert in Zeile 267 der Datei dng.c.

268 {
269  switch(type & 0xFF)
270  {
271  case T_BYTE:
272  case T_SBYTE:
273  case T_UNDEFINED:
274  case T_ASCII: return 1;
275  case T_SHORT:
276  case T_SSHORT: return 2;
277  case T_LONG:
278  case T_SLONG:
279  case T_FLOAT: return 4;
280  case T_RATIONAL:
281  case T_SRATIONAL:
282  case T_DOUBLE: return 8;
283  default: return 0;
284  }
285 }
static void inc_ifd_count ( ifd_entry ifd,
__attribute__((unused)) dir_entry e 
)
static

Definiert in Zeile 389 der Datei dng.c.

390 {
391  ifd->count++;
392 }
static void inc_raw_offset ( __attribute__((unused)) ifd_entry ifd,
dir_entry e 
)
static

Definiert in Zeile 404 der Datei dng.c.

405 {
406  raw_offset += 12; // IFD directory entry size
407  int size_ext = get_type_size(e->type) * e->count;
408  if (size_ext > 4) raw_offset += size_ext + (size_ext&1);
409 }
void load_bad_pixels_list_b ( char *  filename)

Definiert in Zeile 1014 der Datei dng.c.

1015 {
1016  struct stat st;
1017  long filesize;
1018  void* ptr;
1019  FILE *fd;
1020 
1021  if ( filename==0 )
1022  {
1024  return;
1025  }
1026 
1027  binary_count=-1;
1028  if (stat(filename,&st)!=0) return;
1029  filesize=st.st_size;
1030  if (filesize%sizeof(short) != 0) return;
1031  if (filesize == 0) { binary_count = 0; return; } // Allow empty badpixel.bin file
1032  ptr=malloc(filesize);
1033  if (!ptr) return;
1034  fd=fopen(filename, "rb");
1035  if (fd)
1036  {
1037  fread(ptr,1, filesize,fd);
1038  fclose(fd);
1039  binary_list=ptr;
1040  binary_count=filesize/sizeof(short);
1041  }
1042  else free(ptr);
1043 }
static void load_dng_to_rawbuffer ( char *  fn,
char *  rawadr 
)
static

Definiert in Zeile 843 der Datei dng.c.

844 {
845  running = 1;
846 
847  struct stat st;
848  if ((stat(fn,&st) == 0) && (st.st_size >= camera_sensor.raw_size))
849  {
850  int fd = open(fn, O_RDONLY, 0777);
851  if (fd >= 0)
852  {
853  lseek(fd, st.st_size-camera_sensor.raw_size, SEEK_SET);
855  close(fd);
857  }
858  }
859 
860  running = 0;
861 }
void patch_bad_pixels_b ( void  )

Definiert in Zeile 1045 der Datei dng.c.

1046 {
1047  int i;
1048  short* ptr=binary_list;
1049  short x, y, xcnt, ycnt;
1050  for (i=0; i<binary_count;)
1051  {
1052  x = ptr[i] & 0x1FFF;
1053  xcnt = (ptr[i] >> 13) & 7;
1054  i++;
1055  for (; xcnt>=0; xcnt--)
1056  {
1057  y = ptr[i] & 0x1FFF;
1058  ycnt = (ptr[i] >> 13) & 7;
1059  i++;
1060  for (; ycnt>=0; ycnt--, y++)
1062  patch_bad_pixel(x, y);
1063  }
1064  }
1065 }
int pow_calc ( int  mult,
int  x,
int  x_div,
int  y,
int  y_div 
)

Definiert in Zeile 715 der Datei dng.c.

716 {
717  return pow_calc_2( mult, x, x_div, y, y_div);
718 }
int pow_calc_2 ( int  mult,
int  x,
int  x_div,
double  y,
int  y_div 
)

Definiert in Zeile 703 der Datei dng.c.

704 {
705  double x1 = x;
706  if ( x_div != 1 ) { x1=x1/x_div;}
707  if ( y_div != 1 ) { y=y/y_div;}
708 
709  if ( mult==1 )
710  return pow( x1, y );
711  else
712  return mult * pow( x1, y );
713 }
static void process_entries ( ifd_entry ifd,
void(*)(ifd_entry *, dir_entry *)  f 
)
static

Definiert in Zeile 375 der Datei dng.c.

376 {
377  int i;
378  for (i=0; ifd->entry[i].type != T_EOL; i++)
379  {
380  if ((ifd->entry[i].type & T_SKIP) == 0) // Exclude skipped entries (e.g. GPS info if camera doesn't have GPS)
381  {
382  f(ifd, &ifd->entry[i]);
383  }
384  }
385 }
static void process_ifd_list ( void(*)(ifd_entry *)  f)
static

Definiert in Zeile 362 der Datei dng.c.

363 {
364  int i;
365  for (i=0; ifd_list[i].type!=0; i++)
366  {
367  if ((ifd_list[i].type & IFD_SKIP) == 0)
368  {
369  f(&ifd_list[i]);
370  }
371  }
372 }
int raw_init_badpixel_bin ( )

Definiert in Zeile 948 der Datei dng.c.

949 {
950  int count;
951  int x, y, xlen, ylen;
952  unsigned short c[9];
953 
954  FILE*f;
956  {
957  f=fopen(PATH_BAD_TMP_BIN,"w+b");
958  }
960  {
961  f=NULL;
962  }
963  else
964  {
965  return 0;
966  }
967  count = 0;
968  for (x=camera_sensor.active_area.x1; x<camera_sensor.active_area.x2; x++)
969  {
970  xlen = 0;
971  for (y=camera_sensor.active_area.y1; y<camera_sensor.active_area.y2; y++)
972  {
974  {
975  for (ylen=1; ylen<8 && (y+ylen)<camera_sensor.active_area.y2; ylen++)
977  break;
978  if (f)
979  {
980  c[++xlen] = y | ((ylen-1) << 13);
981  if (xlen == 8)
982  {
983  c[0] = x | ((xlen-1) << 13);
984  fwrite(c, 2, xlen+1, f);
985  xlen = 0;
986  }
987  }
988  count = count + ylen;
989  y += ylen - 1;
990  }
991  }
992  if (f && (xlen > 0))
993  {
994  c[0] = x | ((xlen-1) << 13);
995  fwrite(c, 2, xlen+1, f);
996  }
997  }
998  if (f) fclose(f);
1001  return 1;
1002 }
void reverse_bytes_order2 ( char *  from,
char *  to,
int  count 
)
void reverse_bytes_task ( )

Definiert in Zeile 1217 der Datei dng.c.

1217  {
1218  char *src = rb_state.src;
1219  rb_state.stage = RB_STAGE_REVERSING;
1220  rb_state.reversed = rb_state.dst;
1221  // reverse byte order of frame buffer for DNG in chunks, to allow writing to proceed in parallel
1222  while(rb_state.reversed < rb_state.end) {
1223  int chunk_size;
1224  if(rb_state.reversed + DNG_REV_CHUNK_SIZE > rb_state.end) {
1225  chunk_size = rb_state.end - rb_state.reversed;
1226  } else {
1227  chunk_size = DNG_REV_CHUNK_SIZE;
1228  }
1229  reverse_bytes_order2(src, rb_state.reversed, chunk_size);
1230  src += chunk_size;
1231  rb_state.reversed += chunk_size;
1232  // seems to give slightly faster times with less variation
1233  // usually plenty of time to reverse, but in configurations with
1234  // slow camera + small sensor + fast card + single buffer
1235  // may cause some avoidable overhead
1236  msleep(10);
1237  }
1239  // if only a single raw buffer exists, restore the original byte order for
1240  // the portions of the buffer which have been written out, waiting as needed
1241  if(rb_state.src == rb_state.dst) {
1242  src = rb_state.src;
1243  while(src < rb_state.end) {
1244  int chunk_size = rb_state.written - src;
1245  if(!chunk_size) {
1246  msleep(10);
1247  continue;
1248  }
1249  reverse_bytes_order2(src, src, chunk_size);
1250  src += chunk_size;
1251  }
1252  // if reverse was done on cached raw,
1253  // clean cache so canon FW doesn't see reversed data in uncached
1254  if(ADR_IS_CACHED(rb_state.dst)) {
1255  dcache_clean_all();
1256  }
1257  }
1258 
1259 
1260  rb_state.stage = RB_STAGE_DONE;
1261  ExitTask();
1262 }
void unload_bad_pixels_list_b ( void  )

Definiert in Zeile 1007 der Datei dng.c.

1008 {
1010  binary_list=NULL;
1011  binary_count=-1;
1012 }
int write_dng ( char *  rawadr,
char *  altrawadr 
)

Definiert in Zeile 1268 der Datei dng.c.

1269 {
1270  int fd;
1271 
1273 
1274  if (!dng_header_buf) {
1275  return 0;
1276  }
1277 
1278  if (conf.dng_version)
1280 
1281  create_thumbnail();
1282 
1283  // TODO - sanity check that prevous task isn't hanging around
1284  if(rb_state.stage != RB_STAGE_DONE) {
1285  int i;
1286  for(i=0;i<50;i++) {
1287  debug_led(1);
1288  msleep(200);
1289  debug_led(0);
1290  msleep(200);
1291  }
1292  return 0;
1293  }
1294  rb_state.stage = RB_STAGE_INIT;
1295  rb_state.src = rawadr;
1296  rb_state.written = rb_state.reversed = rb_state.dst = altrawadr;
1298 
1299  // task is created with lower priority than spytask (0x19)
1300  // to improve chance of spytask getting control when write completes
1301  CreateTask("RevBytes",0x1A,0x400,reverse_bytes_task);
1302 
1303  fd = raw_createfile();
1304  if(fd < 0) {
1305  // task already started, pretend write completed and wait
1306  rb_state.written = rb_state.end;
1307  while(rb_state.stage != RB_STAGE_DONE) {
1308  msleep(10);
1309  }
1310  return 0;
1311  }
1312 
1313  // ensure thumbnail is written to uncached
1314  dcache_clean_all();
1316  free_dng_header();
1317 
1318  while(rb_state.written < rb_state.end) {
1319  int size = rb_state.reversed - rb_state.written;
1320  if(!size) {
1321  msleep(10);
1322  continue;
1323  }
1324  // if de-reversing, force DNG_NUM_END_CHUNKS at the end, gives better performance on vxworks
1325  // doesn't seem to have significant cost on dryos
1326  if(rawadr == altrawadr) {
1327  if(size > DNG_END_CHUNK_SIZE && (rb_state.written + DNG_END_CHUNK_SIZE*DNG_END_NUM_CHUNKS) >= rb_state.end) {
1328  size = DNG_END_CHUNK_SIZE;
1329  }
1330  }
1331  // ensure reversed data is cleaned out to uncached before attempting write
1332  if(conf.raw_cache) {
1333  dcache_clean_all();
1334  }
1335  write(fd,ADR_TO_UNCACHED(rb_state.written),size);
1336  rb_state.written += size;
1337  }
1338 
1339  raw_closefile(fd);
1340 
1341  // wait for de-reverse, if required
1342  while(rb_state.stage != RB_STAGE_DONE) {
1343  msleep(10);
1344  }
1345  return 1;
1346 }

Variablen-Dokumentation

ModuleInfo _module_info
Initialisierung:

Definiert in Zeile 1404 der Datei dng.c.

int active_area[4]
static

Definiert in Zeile 193 der Datei dng.c.

char artist_name[64] = ""
static

Definiert in Zeile 72 der Datei dng.c.

int badpix_cnt1
static

Definiert in Zeile 1074 der Datei dng.c.

unsigned int badpixel_opcode[]
static
Initialisierung:
=
{
BE(1),
BE(4),
BE(0x01030000),
BE(1),
BE(8),
BE(0),
BE(0),
}

Definiert in Zeile 104 der Datei dng.c.

int binary_count =-1

Definiert in Zeile 1005 der Datei dng.c.

short* binary_list =NULL

Definiert in Zeile 1004 der Datei dng.c.

const int cam_AnalogBalance[] = {1,1,1,1,1,1}

Definiert in Zeile 70 der Datei dng.c.

int cam_aperture[2] = { 0, 10 }
static

Definiert in Zeile 80 der Datei dng.c.

int cam_apex_aperture[2] = { 0, 96 }
static

Definiert in Zeile 82 der Datei dng.c.

int cam_apex_shutter[2] = { 0, 96 }
static

Definiert in Zeile 81 der Datei dng.c.

int cam_AsShotNeutral[] = {1000,1000,1000,1000,1000,1000}
static

Definiert in Zeile 76 der Datei dng.c.

const int cam_BaselineNoise[] = {1,1}

Definiert in Zeile 67 der Datei dng.c.

const int cam_BaselineSharpness[] = {4,3}

Definiert in Zeile 68 der Datei dng.c.

char cam_datetime[20] = ""
static

Definiert in Zeile 77 der Datei dng.c.

int cam_exp_bias[2] = { 0, 96 }
static

Definiert in Zeile 83 der Datei dng.c.

int cam_focal_length[2] = { 0, 1000 }
static

Definiert in Zeile 85 der Datei dng.c.

const int cam_LinearResponseLimit[] = {1,1}

Definiert in Zeile 69 der Datei dng.c.

int cam_max_av[2] = { 0, 96 }
static

Definiert in Zeile 84 der Datei dng.c.

char cam_name[32] = ""
static

Definiert in Zeile 71 der Datei dng.c.

const short cam_PreviewBitsPerSample[] = {8,8,8}

Definiert in Zeile 74 der Datei dng.c.

const int cam_Resolution[] = {180,1}

Definiert in Zeile 75 der Datei dng.c.

int cam_shutter[2] = { 0, 1000000 }
static

Definiert in Zeile 79 der Datei dng.c.

int cam_subject_distance[2] = { 0, 1000 }
static

Definiert in Zeile 86 der Datei dng.c.

char cam_subsectime[4] = ""
static

Definiert in Zeile 78 der Datei dng.c.

char copyright[64] = ""
static

Definiert in Zeile 73 der Datei dng.c.

int crop_origin[2]
static

Definiert in Zeile 191 der Datei dng.c.

int crop_size[2]
static

Definiert in Zeile 192 der Datei dng.c.

char* dng_header_buf = 0

Definiert in Zeile 341 der Datei dng.c.

int dng_header_buf_offset

Definiert in Zeile 343 der Datei dng.c.

int dng_header_buf_size

Definiert in Zeile 342 der Datei dng.c.

char* dst

Definiert in Zeile 1209 der Datei dng.c.

char* end

Definiert in Zeile 1210 der Datei dng.c.

struct t_data_for_exif exif_data
static

Definiert in Zeile 98 der Datei dng.c.

dir_entry exif_ifd[]
Initialisierung:
={
{0x829A, T_RATIONAL, 1, (int)cam_shutter},
{0x829D, T_RATIONAL, 1, (int)cam_aperture},
{0x8822, T_SHORT, 1, 0},
{0x8827, T_SHORT|T_PTR,1, (int)&exif_data.iso},
{0x9000, T_UNDEFINED, 4, 0x31323230},
{0x9003, T_ASCII, 20, (int)cam_datetime},
{0x9201, T_SRATIONAL, 1, (int)cam_apex_shutter},
{0x9202, T_RATIONAL, 1, (int)cam_apex_aperture},
{0x9204, T_SRATIONAL, 1, (int)cam_exp_bias},
{0x9205, T_RATIONAL, 1, (int)cam_max_av},
{0x9206, T_RATIONAL, 1, (int)cam_subject_distance},
{0x9207, T_SHORT, 1, 0},
{0x9209, T_SHORT, 1, 0},
{0x920A, T_RATIONAL, 1, (int)cam_focal_length},
{0x9290, T_ASCII|T_PTR,4, (int)cam_subsectime},
{0x9291, T_ASCII|T_PTR,4, (int)cam_subsectime},
{0, T_EOL, 0, 0},
}

Definiert in Zeile 228 der Datei dng.c.

int extra_offset
static

Definiert in Zeile 419 der Datei dng.c.

const unsigned char gamma[256]
static
Initialisierung:
=
{
0,15,22,27,31,35,39,42,45,47,50,52,75,77,79,82,
84,86,88,90,92,93,95,97,99,100,102,103,105,106,108,109,
111,112,113,115,116,117,119,120,121,122,123,125,126,127,128,129,
130,131,132,133,134,136,137,138,139,140,141,141,142,143,144,145,
180,181,181,182,183,183,184,185,185,186,187,187,188,189,189,190,
190,191,192,192,193,193,194,194,195,195,196,197,197,198,198,199,
199,200,200,201,201,202,202,203,203,204,204,205,205,206,206,207,
207,208,208,208,209,209,210,210,211,211,212,212,212,213,213,214,
214,215,215,215,216,216,217,217,217,218,218,219,219,219,220,220,
221,221,221,222,222,222,223,223,224,224,224,225,225,225,226,226,
226,227,227,228,228,228,229,229,229,230,230,230,231,231,231,232,
232,232,233,233,233,234,234,234,235,235,235,235,236,236,236,237,
237,237,238,238,238,239,239,239,239,240,240,240,241,241,241,242,
242,242,242,243,243,243,244,244,244,244,245,245,245,246,246,246,
246,247,247,247,247,248,248,248,249,249,249,249,250,250,250,250,
251,251,251,251,252,252,252,252,253,253,253,253,254,254,254,255
}

Definiert in Zeile 880 der Datei dng.c.

dir_entry gpd_ifd[]
Initialisierung:
={
{0x0000, T_BYTE, 4, 0x00000302},
{0x0001, T_ASCII|T_PTR, 2, (int)gps_data.latitudeRef},
{0x0002, T_RATIONAL, 3, (int)gps_data.latitude},
{0x0003, T_ASCII|T_PTR, 2, (int)gps_data.longitudeRef},
{0x0004, T_RATIONAL, 3, (int)gps_data.longitude},
{0x0005, T_BYTE|T_PTR, 1, (int)&gps_data.heightRef},
{0x0006, T_RATIONAL, 1, (int)gps_data.height},
{0x0007, T_RATIONAL, 3, (int)gps_data.timeStamp},
{0x0009, T_ASCII|T_PTR, 2, (int)gps_data.status},
{0x0012, T_ASCII, 7, (int)gps_data.mapDatum},
{0x001D, T_ASCII, 11, (int)gps_data.dateStamp},
{0, T_EOL, 0, 0},
}

Definiert in Zeile 251 der Datei dng.c.

tGPS gps_data

Definiert in Zeile 249 der Datei dng.c.

dir_entry ifd0[]

Definiert in Zeile 141 der Datei dng.c.

dir_entry ifd1[]
Initialisierung:
={
{0xFE, T_LONG, 1, 0},
{0x100, T_LONG|T_PTR, 1, (int)&camera_sensor.raw_rowpix},
{0x101, T_LONG|T_PTR, 1, (int)&camera_sensor.raw_rows},
{0x103, T_SHORT, 1, 1},
{0x106, T_SHORT, 1, 0x8023},
{0x111, T_LONG, 1, 0},
{0x115, T_SHORT, 1, 1},
{0x116, T_SHORT|T_PTR,1, (int)&camera_sensor.raw_rows},
{0x117, T_LONG|T_PTR, 1, (int)&camera_sensor.raw_size},
{0x11A, T_RATIONAL, 1, (int)cam_Resolution},
{0x11B, T_RATIONAL, 1, (int)cam_Resolution},
{0x11C, T_SHORT, 1, 1},
{0x128, T_SHORT, 1, 2},
{0x828D, T_SHORT, 2, 0x00020002},
{0x828E, T_BYTE|T_PTR, 4, (int)&camera_sensor.cfa_pattern},
{0xC61A, T_LONG|T_PTR, 1, (int)&camera_sensor.black_level},
{0xC61D, T_LONG|T_PTR, 1, (int)&camera_sensor.white_level},
{0xC61F, T_LONG, 2, (int)&crop_origin},
{0xC620, T_LONG, 2, (int)&crop_size},
{0xC68D, T_LONG, 4, (int)&active_area},
{0xC740, T_UNDEFINED|T_PTR, sizeof(badpixel_opcode), (int)&badpixel_opcode},
{0, T_EOL, 0, 0},
}

Definiert in Zeile 195 der Datei dng.c.

ifd_entry ifd_list[]
Initialisierung:
=
{
{ifd0, 0, IFD_0},
{ifd1, 0, IFD_1},
{0,0,0},
}

Definiert in Zeile 302 der Datei dng.c.

int init_badpixel_bin_flag

Definiert in Zeile 946 der Datei dng.c.

int raw_offset
static

Definiert in Zeile 402 der Datei dng.c.

struct { ... } rb_state
char* reversed

Definiert in Zeile 1212 der Datei dng.c.

int running = 0
static

Definiert in Zeile 26 der Datei dng.c.

char* src

Definiert in Zeile 1208 der Datei dng.c.

int stage

Definiert in Zeile 1214 der Datei dng.c.

char* thumbnail_buf = 0

Definiert in Zeile 344 der Datei dng.c.

char* written

Definiert in Zeile 1213 der Datei dng.c.