CHDK_DE Vorschauversion  Trunk Rev. 5215
 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 "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, dir_entry *e)
 
static void calc_ifd_count (ifd_entry *ifd)
 
static void inc_raw_offset (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 (ifd_entry *ifd, dir_entry *e)
 
static void add_ifd_to_buffer (ifd_entry *ifd)
 
static void add_entry_extra_data_to_buffer (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 unsigned 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 124 der Datei dng.c.

#define BADPIX_CFA_INDEX   6

Definiert in Zeile 101 der Datei dng.c.

#define BADPIXEL_OPCODE_TAG   0xC740

Definiert in Zeile 187 der Datei dng.c.

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

Definiert in Zeile 99 der Datei dng.c.

#define BUF_SIZE   (32768)
#define CALIBRATION1_TAG   0xc623

Definiert in Zeile 132 der Datei dng.c.

#define CALIBRATION2_TAG   0xc624

Definiert in Zeile 133 der Datei dng.c.

#define CAM_MAKE   "Canon"

Definiert in Zeile 138 der Datei dng.c.

#define CAMERA_NAME_TAG   0x110

Definiert in Zeile 120 der Datei dng.c.

#define CHDK_VER_TAG   0x131

Definiert in Zeile 123 der Datei dng.c.

#define COLOR_MATRIX2_TAG   0xc622

Definiert in Zeile 131 der Datei dng.c.

#define COPYRIGHT_TAG   0x8298

Definiert in Zeile 126 der Datei dng.c.

#define DNG_END_CHUNK_SIZE   (512*1024)

Definiert in Zeile 1197 der Datei dng.c.

#define DNG_END_NUM_CHUNKS   (3)

Definiert in Zeile 1202 der Datei dng.c.

#define DNG_REV_CHUNK_SIZE   (512*1024)

Definiert in Zeile 1187 der Datei dng.c.

#define DNG_TH_BYTES   (DNG_TH_WIDTH*DNG_TH_HEIGHT*3)

Definiert in Zeile 30 der Datei dng.c.

#define DNG_TH_HEIGHT   96

Definiert in Zeile 29 der Datei dng.c.

#define DNG_TH_WIDTH   128

Definiert in Zeile 28 der Datei dng.c.

#define DNG_VERSION_TAG   0xC612

Definiert in Zeile 129 der Datei dng.c.

#define EXIF_IFD_TAG   0x8769

Definiert in Zeile 127 der Datei dng.c.

#define EXPOSURE_PROGRAM_TAG   0x8822

Definiert in Zeile 221 der Datei dng.c.

#define FLASH_MODE_TAG   0x9209

Definiert in Zeile 223 der Datei dng.c.

#define FORWARD_MATRIX1_TAG   0xc714

Definiert in Zeile 135 der Datei dng.c.

#define FORWARD_MATRIX2_TAG   0xc715

Definiert in Zeile 136 der Datei dng.c.

#define GPS_IFD_TAG   0x8825

Definiert in Zeile 128 der Datei dng.c.

#define IFD_0   1

Definiert in Zeile 287 der Datei dng.c.

#define IFD_1   2

Definiert in Zeile 288 der Datei dng.c.

#define IFD_EXIF   3

Definiert in Zeile 289 der Datei dng.c.

#define IFD_GPS   4

Definiert in Zeile 290 der Datei dng.c.

#define IFD_SKIP   0x200

Definiert in Zeile 291 der Datei dng.c.

#define IFD_TYPE_MASK   0xF

Definiert in Zeile 292 der Datei dng.c.

#define ILLUMINANT2_TAG   0xc65b

Definiert in Zeile 134 der Datei dng.c.

#define INIT_BADPIXEL_COUNT   -1

Definiert in Zeile 939 der Datei dng.c.

#define INIT_BADPIXEL_FILE   -2

Definiert in Zeile 940 der Datei dng.c.

#define METERING_MODE_TAG   0x9207

Definiert in Zeile 222 der Datei dng.c.

#define ORIENTATION_TAG   0x112

Definiert in Zeile 122 der Datei dng.c.

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

Definiert in Zeile 943 der Datei dng.c.

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

Definiert in Zeile 942 der Datei dng.c.

#define RAW_DATA_TAG   0x111

Definiert in Zeile 186 der Datei dng.c.

#define RB_STAGE_DEREVERSING   3

Definiert in Zeile 1177 der Datei dng.c.

#define RB_STAGE_DONE   0

Definiert in Zeile 1174 der Datei dng.c.

#define RB_STAGE_INIT   1

Definiert in Zeile 1175 der Datei dng.c.

#define RB_STAGE_REVERSING   2

Definiert in Zeile 1176 der Datei dng.c.

#define SSTIME_ORIG_TAG   0x9291

Definiert in Zeile 225 der Datei dng.c.

#define SSTIME_TAG   0x9290

Definiert in Zeile 224 der Datei dng.c.

#define SUBIFDS_TAG   0x14A

Definiert in Zeile 125 der Datei dng.c.

#define T_ASCII   2

Definiert in Zeile 47 der Datei dng.c.

#define T_BYTE   1

Definiert in Zeile 46 der Datei dng.c.

#define T_DOUBLE   12

Definiert in Zeile 57 der Datei dng.c.

#define T_EOL   0

Definiert in Zeile 45 der Datei dng.c.

#define T_FLOAT   11

Definiert in Zeile 56 der Datei dng.c.

#define T_LONG   4

Definiert in Zeile 49 der Datei dng.c.

#define T_PTR   0x100

Definiert in Zeile 58 der Datei dng.c.

#define T_RATIONAL   5

Definiert in Zeile 50 der Datei dng.c.

#define T_SBYTE   6

Definiert in Zeile 51 der Datei dng.c.

#define T_SHORT   3

Definiert in Zeile 48 der Datei dng.c.

#define T_SKIP   0x200

Definiert in Zeile 59 der Datei dng.c.

#define T_SLONG   9

Definiert in Zeile 54 der Datei dng.c.

#define T_SRATIONAL   10

Definiert in Zeile 55 der Datei dng.c.

#define T_SSHORT   8

Definiert in Zeile 53 der Datei dng.c.

#define T_UNDEFINED   7

Definiert in Zeile 52 der Datei dng.c.

#define THUMB_DATA_TAG   0x111

Definiert in Zeile 121 der Datei dng.c.

#define TIFF_HDR_SIZE   (8)

Definiert in Zeile 338 der Datei dng.c.

#define UNIQUE_CAMERA_MODEL_TAG   0xC614

Definiert in Zeile 130 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 1116 der Datei dng.c.

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

Definiert in Zeile 1082 der Datei dng.c.

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

Definiert in Zeile 1075 der Datei dng.c.

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

Definiert in Zeile 1134 der Datei dng.c.

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

Definiert in Zeile 460 der Datei dng.c.

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

Definiert in Zeile 427 der Datei dng.c.

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

Definiert in Zeile 470 der Datei dng.c.

471 {
473 }
static void add_ifd_to_buffer ( ifd_entry ifd)
static

Definiert in Zeile 451 der Datei dng.c.

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

Definiert in Zeile 348 der Datei dng.c.

349 {
351  dng_header_buf_offset += size;
352 }
void add_val_to_buf ( int  val,
int  size 
)

Definiert in Zeile 355 der Datei dng.c.

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

Definiert in Zeile 1066 der Datei dng.c.

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

Definiert in Zeile 420 der Datei dng.c.

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

Definiert in Zeile 393 der Datei dng.c.

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

Definiert in Zeile 410 der Datei dng.c.

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

Definiert in Zeile 720 der Datei dng.c.

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

Definiert in Zeile 788 der Datei dng.c.

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

Definiert in Zeile 1158 der Datei dng.c.

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

Definiert in Zeile 481 der Datei dng.c.

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

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

Definiert in Zeile 646 der Datei dng.c.

647 {
648  if (dng_header_buf)
649  {
652  }
653 }
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 656 der Datei dng.c.

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

Definiert in Zeile 680 der Datei dng.c.

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

Definiert in Zeile 311 der Datei dng.c.

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

Definiert in Zeile 691 der Datei dng.c.

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

Definiert in Zeile 668 der Datei dng.c.

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

Definiert in Zeile 323 der Datei dng.c.

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

Definiert in Zeile 266 der Datei dng.c.

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

Definiert in Zeile 388 der Datei dng.c.

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

Definiert in Zeile 403 der Datei dng.c.

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

Definiert in Zeile 1013 der Datei dng.c.

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

Definiert in Zeile 842 der Datei dng.c.

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

Definiert in Zeile 1044 der Datei dng.c.

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

Definiert in Zeile 714 der Datei dng.c.

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

Definiert in Zeile 702 der Datei dng.c.

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

Definiert in Zeile 374 der Datei dng.c.

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

Definiert in Zeile 361 der Datei dng.c.

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

Definiert in Zeile 947 der Datei dng.c.

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

Definiert in Zeile 1216 der Datei dng.c.

1216  {
1217  char *src = rb_state.src;
1218  rb_state.stage = RB_STAGE_REVERSING;
1219  rb_state.reversed = rb_state.dst;
1220  // reverse byte order of frame buffer for DNG in chunks, to allow writing to proceed in parallel
1221  while(rb_state.reversed < rb_state.end) {
1222  int chunk_size;
1223  if(rb_state.reversed + DNG_REV_CHUNK_SIZE > rb_state.end) {
1224  chunk_size = rb_state.end - rb_state.reversed;
1225  } else {
1226  chunk_size = DNG_REV_CHUNK_SIZE;
1227  }
1228  reverse_bytes_order2(src, rb_state.reversed, chunk_size);
1229  src += chunk_size;
1230  rb_state.reversed += chunk_size;
1231  // seems to give slightly faster times with less variation
1232  // usually plenty of time to reverse, but in configurations with
1233  // slow camera + small sensor + fast card + single buffer
1234  // may cause some avoidable overhead
1235  msleep(10);
1236  }
1238  // if only a single raw buffer exists, restore the original byte order for
1239  // the portions of the buffer which have been written out, waiting as needed
1240  if(rb_state.src == rb_state.dst) {
1241  src = rb_state.src;
1242  int offset = 0;
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 1006 der Datei dng.c.

1007 {
1009  binary_list=NULL;
1010  binary_count=-1;
1011 }
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 192 der Datei dng.c.

char artist_name[64] = ""
static

Definiert in Zeile 71 der Datei dng.c.

unsigned int badpix_cnt1
static

Definiert in Zeile 1073 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 103 der Datei dng.c.

int binary_count =-1

Definiert in Zeile 1004 der Datei dng.c.

short* binary_list =NULL

Definiert in Zeile 1003 der Datei dng.c.

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

Definiert in Zeile 69 der Datei dng.c.

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

Definiert in Zeile 79 der Datei dng.c.

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

Definiert in Zeile 81 der Datei dng.c.

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

Definiert in Zeile 80 der Datei dng.c.

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

Definiert in Zeile 75 der Datei dng.c.

const int cam_BaselineNoise[] = {1,1}

Definiert in Zeile 66 der Datei dng.c.

const int cam_BaselineSharpness[] = {4,3}

Definiert in Zeile 67 der Datei dng.c.

char cam_datetime[20] = ""
static

Definiert in Zeile 76 der Datei dng.c.

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

Definiert in Zeile 82 der Datei dng.c.

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

Definiert in Zeile 84 der Datei dng.c.

const int cam_LinearResponseLimit[] = {1,1}

Definiert in Zeile 68 der Datei dng.c.

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

Definiert in Zeile 83 der Datei dng.c.

char cam_name[32] = ""
static

Definiert in Zeile 70 der Datei dng.c.

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

Definiert in Zeile 73 der Datei dng.c.

const int cam_Resolution[] = {180,1}

Definiert in Zeile 74 der Datei dng.c.

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

Definiert in Zeile 78 der Datei dng.c.

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

Definiert in Zeile 85 der Datei dng.c.

char cam_subsectime[4] = ""
static

Definiert in Zeile 77 der Datei dng.c.

char copyright[64] = ""
static

Definiert in Zeile 72 der Datei dng.c.

int crop_origin[2]
static

Definiert in Zeile 190 der Datei dng.c.

int crop_size[2]
static

Definiert in Zeile 191 der Datei dng.c.

char* dng_header_buf = 0

Definiert in Zeile 340 der Datei dng.c.

int dng_header_buf_offset

Definiert in Zeile 342 der Datei dng.c.

int dng_header_buf_size

Definiert in Zeile 341 der Datei dng.c.

char* dst

Definiert in Zeile 1208 der Datei dng.c.

char* end

Definiert in Zeile 1209 der Datei dng.c.

struct t_data_for_exif exif_data
static

Definiert in Zeile 97 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 227 der Datei dng.c.

int extra_offset
static

Definiert in Zeile 418 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 879 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 250 der Datei dng.c.

tGPS gps_data

Definiert in Zeile 248 der Datei dng.c.

dir_entry ifd0[]

Definiert in Zeile 140 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 194 der Datei dng.c.

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

Definiert in Zeile 301 der Datei dng.c.

int init_badpixel_bin_flag

Definiert in Zeile 945 der Datei dng.c.

int raw_offset
static

Definiert in Zeile 401 der Datei dng.c.

struct { ... } rb_state
char* reversed

Definiert in Zeile 1211 der Datei dng.c.

int running = 0
static

Definiert in Zeile 25 der Datei dng.c.

char* src

Definiert in Zeile 1207 der Datei dng.c.

int stage

Definiert in Zeile 1213 der Datei dng.c.

char* thumbnail_buf = 0

Definiert in Zeile 343 der Datei dng.c.

char* written

Definiert in Zeile 1212 der Datei dng.c.