diff options
Diffstat (limited to 'converter/other/cameratopam')
-rw-r--r-- | converter/other/cameratopam/camera.c | 87 | ||||
-rw-r--r-- | converter/other/cameratopam/camera.h | 2 | ||||
-rw-r--r-- | converter/other/cameratopam/cameratopam.c | 46 | ||||
-rw-r--r-- | converter/other/cameratopam/canon.c | 3 | ||||
-rw-r--r-- | converter/other/cameratopam/decode.c | 12 | ||||
-rw-r--r-- | converter/other/cameratopam/decode.h | 14 | ||||
-rw-r--r-- | converter/other/cameratopam/dng.c | 2 | ||||
-rw-r--r-- | converter/other/cameratopam/dng.h | 2 | ||||
-rw-r--r-- | converter/other/cameratopam/foveon.c | 13 | ||||
-rw-r--r-- | converter/other/cameratopam/foveon.h | 6 | ||||
-rw-r--r-- | converter/other/cameratopam/identify.c | 4 | ||||
-rw-r--r-- | converter/other/cameratopam/ljpeg.c | 3 | ||||
-rw-r--r-- | converter/other/cameratopam/ljpeg.h | 4 | ||||
-rw-r--r-- | converter/other/cameratopam/util.c | 11 |
14 files changed, 164 insertions, 45 deletions
diff --git a/converter/other/cameratopam/camera.c b/converter/other/cameratopam/camera.c index 4610462c..62b58ad5 100644 --- a/converter/other/cameratopam/camera.c +++ b/converter/other/cameratopam/camera.c @@ -56,7 +56,6 @@ merror (const void *ptr, const char *where) - static void adobeCopyPixel(Image const image, unsigned int const row, @@ -87,6 +86,8 @@ adobeCopyPixel(Image const image, --(*rp); } + + void adobe_dng_load_raw_lj(Image const image) { @@ -187,6 +188,8 @@ nikon_compressed_load_raw(Image const image) { free (curve); } + + void nikon_load_raw(Image const image) { @@ -213,6 +216,8 @@ nikon_load_raw(Image const image) { } } + + /* Figure out if a NEF file is compressed. These fancy heuristics are only needed for the D100, thanks to a bug in some cameras @@ -235,6 +240,8 @@ nikon_is_compressed() return 0; } + + /* Returns 1 for a Coolpix 990, 0 for a Coolpix 995. */ @@ -254,6 +261,8 @@ nikon_e990() return 0; } + + /* Returns 1 for a Coolpix 2100, 0 for anything else. */ @@ -273,6 +282,8 @@ nikon_e2100() return 1; } + + /* Separates a Pentax Optio 33WR from a Nikon E3700. */ @@ -289,6 +300,8 @@ pentax_optio33() return sum[0] < sum[1]*4; } + + /* Separates a Minolta DiMAGE Z2 from a Nikon E4300. */ @@ -305,6 +318,8 @@ minolta_z2() return 0; } + + void nikon_e2100_load_raw(Image const image) { @@ -333,6 +348,8 @@ nikon_e2100_load_raw(Image const image) { } } + + void nikon_e950_load_raw(Image const image) { @@ -349,6 +366,8 @@ nikon_e950_load_raw(Image const image) { maximum = 0x3dd; } + + /* The Fuji Super CCD is just a Bayer grid rotated 45 degrees. */ @@ -368,6 +387,8 @@ fuji_s2_load_raw(Image const image) { } } + + void fuji_s3_load_raw(Image const image) { unsigned short pixel[4352]; @@ -384,6 +405,8 @@ fuji_s3_load_raw(Image const image) { } } + + static void fuji_common_load_raw(Image const image, unsigned int const ncol, @@ -444,6 +467,8 @@ fuji_f700_load_raw(Image const image) { } } + + void rollei_load_raw(Image const image) { unsigned char pixel[10]; @@ -470,6 +495,8 @@ rollei_load_raw(Image const image) { maximum = 0x3ff; } + + void phase_one_load_raw(Image const image) { int row, col, a, b; @@ -496,6 +523,8 @@ phase_one_load_raw(Image const image) { free (pixel); } + + void ixpress_load_raw(Image const image) { unsigned short pixel[4090]; @@ -510,6 +539,8 @@ ixpress_load_raw(Image const image) { } } + + void leaf_load_raw(Image const image) { unsigned short *pixel; @@ -526,6 +557,8 @@ leaf_load_raw(Image const image) { free (pixel); } + + /* For this function only, raw_width is in bytes, not pixels! */ @@ -542,6 +575,8 @@ packed_12_load_raw(Image const image) { } } + + void unpacked_load_raw(Image const image) { unsigned short *pixel; @@ -557,6 +592,8 @@ unpacked_load_raw(Image const image) { free (pixel); } + + void olympus_e300_load_raw(Image const image) { unsigned char *data, *dp; @@ -580,6 +617,8 @@ olympus_e300_load_raw(Image const image) { free (data); } + + void olympus_cseries_load_raw(Image const image) { int irow, row, col; @@ -595,6 +634,8 @@ olympus_cseries_load_raw(Image const image) { } } + + void eight_bit_load_raw(Image const image) { unsigned char *pixel; @@ -611,6 +652,8 @@ eight_bit_load_raw(Image const image) { maximum = 0xff; } + + void casio_qv5700_load_raw(Image const image) { unsigned char data[3232], *dp; @@ -631,6 +674,8 @@ casio_qv5700_load_raw(Image const image) { maximum = 0x3fc; } + + void nucore_load_raw(Image const image) { unsigned short *pixel; @@ -647,6 +692,8 @@ nucore_load_raw(Image const image) { free (pixel); } + + static int radc_token (int tree) { int t; @@ -688,6 +735,8 @@ static int radc_token (int tree) return dindex->leaf; } + + #define FORYX for (y=1; y < 3; y++) for (x=col+1; x >= col; x--) #define PREDICTOR (c ? (buf[c][y-1][x] + buf[c][y][x+1]) / 2 \ @@ -770,6 +819,8 @@ kodak_radc_load_raw(Image const image) { maximum = 0x1fff; /* wild guess */ } + + #undef FORYX #undef PREDICTOR @@ -791,6 +842,8 @@ fill_input_buffer (j_decompress_ptr cinfo) return TRUE; } + + void kodak_jpeg_load_raw(Image const image) { @@ -830,6 +883,8 @@ kodak_jpeg_load_raw(Image const image) maximum = 0xff << 1; } + + #endif void @@ -849,6 +904,8 @@ kodak_dc120_load_raw(Image const image) maximum = 0xff; } + + void kodak_dc20_coeff (float const juice) { @@ -868,6 +925,8 @@ kodak_dc20_coeff (float const juice) use_coeff = 1; } + + void kodak_easy_load_raw(Image const image) { @@ -896,6 +955,8 @@ kodak_easy_load_raw(Image const image) maximum = curve[0xff]; } + + void kodak_compressed_load_raw(Image const image) { @@ -960,6 +1021,8 @@ kodak_compressed_load_raw(Image const image) } } + + void kodak_yuv_load_raw(Image const image) { @@ -1019,6 +1082,8 @@ kodak_yuv_load_raw(Image const image) maximum = 0xe74; } + + static void sony_decrypt (unsigned *data, int len, int start, int key) { static uint32_t pad[128]; @@ -1053,6 +1118,8 @@ static void sony_decrypt (unsigned *data, int len, int start, int key) } } + + void sony_load_raw(Image const image) { @@ -1091,6 +1158,8 @@ sony_load_raw(Image const image) maximum = 0x3ff0; } + + void parse_minolta(FILE * const ifp) { @@ -1124,6 +1193,8 @@ parse_minolta(FILE * const ifp) data_offset = offset; } + + /* CIFF block 0x1030 contains an 8x8 white sample. Load this into white[][] for use in scale_colors(). @@ -1151,6 +1222,8 @@ static void ciff_block_1030() } } + + /* Parse a CIFF file, better known as Canon CRW format. */ @@ -1266,6 +1339,8 @@ common: camera_red = -1; /* Use my auto WB for this photo */ } + + void parse_rollei(FILE * const ifp) { @@ -1333,6 +1408,8 @@ parse_mos(FILE * const ifp, } } + + void nikon_e950_coeff() { @@ -1504,6 +1581,8 @@ get_timestamp(FILE * const ifp) timestamp = ts; } + + static void parse_exif(FILE * const ifp, int base) { @@ -1529,6 +1608,8 @@ parse_exif(FILE * const ifp, int base) } } + + static int parse_tiff_ifd(FILE * const ifp, int base, int level) { @@ -1725,6 +1806,8 @@ guess_cfa_pc: return done; } + + void parse_tiff(FILE * const ifp, int base) { @@ -1797,3 +1880,5 @@ parse_external_jpeg(const char * const ifname) free (jname); } + + diff --git a/converter/other/cameratopam/camera.h b/converter/other/cameratopam/camera.h index 02c3f2af..172bc46e 100644 --- a/converter/other/cameratopam/camera.h +++ b/converter/other/cameratopam/camera.h @@ -5,7 +5,7 @@ #include "cameratopam.h" -void +void parse_ciff(FILE * const ifp, int const offset, int const length); diff --git a/converter/other/cameratopam/cameratopam.c b/converter/other/cameratopam/cameratopam.c index 78eb6854..693d280c 100644 --- a/converter/other/cameratopam/cameratopam.c +++ b/converter/other/cameratopam/cameratopam.c @@ -88,6 +88,8 @@ static void CLASS merror (const void *ptr, const char *where) pm_error ("Out of memory in %s", where); } + + struct CmdlineInfo { /* All the information the user supplied in the command line, in a form easy for the program to use. @@ -136,37 +138,37 @@ parseCommandLine(int argc, char ** argv, opt.allowNegNum = FALSE; option_def_index = 0; /* incremented by OPTENT3 */ - OPTENT3(0, "bright", + OPTENT3(0, "bright", OPT_FLOAT, &cmdlineP->bright, &brightSpec, 0); - OPTENT3(0, "red_scale", + OPTENT3(0, "red_scale", OPT_FLOAT, &cmdlineP->red_scale, &red_scaleSpec, 0); - OPTENT3(0, "blue_scale", + OPTENT3(0, "blue_scale", OPT_FLOAT, &cmdlineP->blue_scale, &blue_scaleSpec, 0); - OPTENT3(0, "profile", + OPTENT3(0, "profile", OPT_STRING, &cmdlineP->profile, &profileSpec, 0); - OPTENT3(0, "identify_only", + OPTENT3(0, "identify_only", OPT_FLAG, NULL, &cmdlineP->identify_only, 0); - OPTENT3(0, "verbose", + OPTENT3(0, "verbose", OPT_FLAG, NULL, &cmdlineP->verbose, 0); - OPTENT3(0, "half_size", + OPTENT3(0, "half_size", OPT_FLAG, NULL, &cmdlineP->half_size, 0); - OPTENT3(0, "four_color_rgb", + OPTENT3(0, "four_color_rgb", OPT_FLAG, NULL, &cmdlineP->four_color_rgb, 0); - OPTENT3(0, "document_mode", + OPTENT3(0, "document_mode", OPT_FLAG, NULL, &cmdlineP->document_mode, 0); - OPTENT3(0, "quick_interpolate", + OPTENT3(0, "quick_interpolate", OPT_FLAG, NULL, &cmdlineP->quick_interpolate, 0); - OPTENT3(0, "balance_auto", + OPTENT3(0, "balance_auto", OPT_FLAG, NULL, &cmdlineP->use_auto_wb, 0); - OPTENT3(0, "balance_camera", + OPTENT3(0, "balance_camera", OPT_FLAG, NULL, &cmdlineP->use_camera_wb, 0); - OPTENT3(0, "use_secondary", + OPTENT3(0, "use_secondary", OPT_FLAG, NULL, &cmdlineP->use_secondary, 0); - OPTENT3(0, "no_clip_color", + OPTENT3(0, "no_clip_color", OPT_FLAG, NULL, &cmdlineP->no_clip_color, 0); - OPTENT3(0, "rgb", + OPTENT3(0, "rgb", OPT_FLAG, NULL, &cmdlineP->use_camera_rgb, 0); - OPTENT3(0, "linear", + OPTENT3(0, "linear", OPT_FLAG, NULL, &cmdlineP->linear, 0); pm_optParseOptions3(&argc, argv, opt, sizeof(opt), 0); @@ -185,12 +187,12 @@ parseCommandLine(int argc, char ** argv, cmdlineP->inputFileName = strdup("-"); /* he wants stdin */ else if (argc - 1 == 1) cmdlineP->inputFileName = strdup(argv[1]); - else + else pm_error("Too many arguments. The only argument accepted " "is the input file name"); } - + static void CLASS fixBadPixels(Image const image) { @@ -658,9 +660,9 @@ fujiRotate(Image * const imageP) { newImage[row*wide+col][i] = (pix[ 0][i]*(1-fc) + pix[ 1][i]*fc) * (1-fr) + (pix[width][i]*(1-fc) + pix[width+1][i]*fc) * fr; - } + } } - } + } free(*imageP); width = wide; height = high; @@ -920,7 +922,7 @@ convertIt(FILE * const ifP, if (flip) { if (cmdline.verbose) pm_message ("Flipping image %c:%c:%c...", - flip & 1 ? 'H':'0', flip & 2 ? 'V':'0', + flip & 1 ? 'H':'0', flip & 2 ? 'V':'0', flip & 4 ? 'T':'0'); flipImage(image); } @@ -931,7 +933,7 @@ convertIt(FILE * const ifP, -int +int main (int argc, char **argv) { FILE * const ofP = stdout; diff --git a/converter/other/cameratopam/canon.c b/converter/other/cameratopam/canon.c index cbf5ece0..f86f43d8 100644 --- a/converter/other/cameratopam/canon.c +++ b/converter/other/cameratopam/canon.c @@ -170,3 +170,6 @@ canon_compressed_load_raw(Image const image) { if (raw_width > width) black /= (raw_width - width) * height; } + + + diff --git a/converter/other/cameratopam/decode.c b/converter/other/cameratopam/decode.c index e3a62fab..d42f8619 100644 --- a/converter/other/cameratopam/decode.c +++ b/converter/other/cameratopam/decode.c @@ -44,15 +44,15 @@ void init_decoder() { */ -unsigned char * -make_decoder(const unsigned char * const source, +unsigned char * +make_decoder(const unsigned char * const source, int const level) { struct decode *cur; static int leaf; int i, next; - if (level==0) + if (level==0) leaf=0; cur = free_decode++; if (free_decode > first_decode+2048) { @@ -74,7 +74,7 @@ make_decoder(const unsigned char * const source, -const int * +const int * make_decoder_int(const int * const source, int const level) { @@ -98,7 +98,7 @@ make_decoder_int(const int * const source, -void +void crw_init_tables(unsigned int const table) { unsigned int const clippedTableNum = MIN(2, table); @@ -170,3 +170,5 @@ crw_init_tables(unsigned int const table) { make_decoder (second_tree[clippedTableNum], 0); } + + diff --git a/converter/other/cameratopam/decode.h b/converter/other/cameratopam/decode.h index b0addc82..e79a6989 100644 --- a/converter/other/cameratopam/decode.h +++ b/converter/other/cameratopam/decode.h @@ -1,22 +1,22 @@ struct decode { struct decode *branch[2]; int leaf; -}; +}; extern struct decode * free_decode; extern struct decode first_decode[2048]; extern struct decode * second_decode; -void +void init_decoder(void); -void +void crw_init_tables(unsigned int const table); -const int * -make_decoder_int (const int * const source, +const int * +make_decoder_int (const int * const source, int const level); -unsigned char * -make_decoder(const unsigned char * const source, +unsigned char * +make_decoder(const unsigned char * const source, int const level); diff --git a/converter/other/cameratopam/dng.c b/converter/other/cameratopam/dng.c index bddfd9f4..fbd2028f 100644 --- a/converter/other/cameratopam/dng.c +++ b/converter/other/cameratopam/dng.c @@ -3,7 +3,7 @@ #include "dng.h" -void +void dng_coeff (double cc[4][4], double cm[4][3], double xyz[3]) { diff --git a/converter/other/cameratopam/dng.h b/converter/other/cameratopam/dng.h index 56293563..2b7c96df 100644 --- a/converter/other/cameratopam/dng.h +++ b/converter/other/cameratopam/dng.h @@ -1,4 +1,4 @@ -void +void dng_coeff(double cc[4][4], double cm[4][3], double xyz[3]); diff --git a/converter/other/cameratopam/foveon.c b/converter/other/cameratopam/foveon.c index 5a26777b..23cffe67 100644 --- a/converter/other/cameratopam/foveon.c +++ b/converter/other/cameratopam/foveon.c @@ -339,6 +339,8 @@ foveon_fixed (void * const ptr, return 1; } + + static float foveon_avg (unsigned short *pix, int range[2], float cfilt) { int i; @@ -353,6 +355,8 @@ static float foveon_avg (unsigned short *pix, int range[2], float cfilt) return (sum - min - max) / (range[1] - range[0] - 1); } + + static short *foveon_make_curve (double max, double mul, double filt) { short *curve; @@ -373,6 +377,8 @@ static short *foveon_make_curve (double max, double mul, double filt) return curve; } + + static void foveon_make_curves (short **curvep, float dq[3], float div[3], float filt) { @@ -384,12 +390,16 @@ static void foveon_make_curves FORC3 curvep[c] = foveon_make_curve (max, mul[c], filt); } + + static int foveon_apply_curve (short *curve, int i) { if (abs(i) >= (unsigned short)curve[0]) return 0; return i < 0 ? -(unsigned short)curve[1-i] : (unsigned short)curve[1+i]; } + + void foveon_interpolate(Image const image, float coeff[3][4]) { @@ -797,3 +807,6 @@ foveon_interpolate(Image const image, width = i; height = row; } + + + diff --git a/converter/other/cameratopam/foveon.h b/converter/other/cameratopam/foveon.h index c9bf48a8..584a38f6 100644 --- a/converter/other/cameratopam/foveon.h +++ b/converter/other/cameratopam/foveon.h @@ -3,15 +3,15 @@ #include "cameratopam.h" #include "camera.h" -void +void parse_foveon(FILE * const ifp); -void +void foveon_interpolate(Image const image, float coeff[3][4]); LoadRawFn foveon_load_raw; -void +void foveon_coeff(int * const useCoeffP, float coeff[3][4]); diff --git a/converter/other/cameratopam/identify.c b/converter/other/cameratopam/identify.c index e5df6b22..c1eb8a25 100644 --- a/converter/other/cameratopam/identify.c +++ b/converter/other/cameratopam/identify.c @@ -263,7 +263,6 @@ adobeCoeff(const char * const make, - int identify(FILE * const ifp, bool const use_secondary, @@ -1206,3 +1205,6 @@ dng_skip: return 0; } + + + diff --git a/converter/other/cameratopam/ljpeg.c b/converter/other/cameratopam/ljpeg.c index 35f50f4b..d1ede87c 100644 --- a/converter/other/cameratopam/ljpeg.c +++ b/converter/other/cameratopam/ljpeg.c @@ -161,3 +161,6 @@ lossless_jpeg_load_raw(Image const image) { if (!strcasecmp(make,"KODAK")) black = min; } + + + diff --git a/converter/other/cameratopam/ljpeg.h b/converter/other/cameratopam/ljpeg.h index 9d9d8ee9..7b1cf364 100644 --- a/converter/other/cameratopam/ljpeg.h +++ b/converter/other/cameratopam/ljpeg.h @@ -8,11 +8,11 @@ struct jhead { LoadRawFn lossless_jpeg_load_raw; -int +int ljpeg_start (FILE * const ifP, struct jhead * const jhP); -int +int ljpeg_diff (FILE * const ifP, struct decode * const dindexP); diff --git a/converter/other/cameratopam/util.c b/converter/other/cameratopam/util.c index ede5ef69..d489b23e 100644 --- a/converter/other/cameratopam/util.c +++ b/converter/other/cameratopam/util.c @@ -28,6 +28,8 @@ get2(FILE * const ifp) return a << 8 | b; } + + /* Same for a 4-byte integer. */ @@ -45,6 +47,8 @@ get4(FILE * const ifp) return a << 24 | b << 16 | c << 8 | d; } + + /* Faster than calling get2() multiple times. */ @@ -68,11 +72,13 @@ read_shorts (FILE * const ifp, unsigned short *pixel, int count) } } + + /* getbits(-1) initializes the buffer getbits(n) where 0 <= n <= 25 returns an n-bit integer */ -unsigned +unsigned getbits (FILE * const ifp, int nbits) { static unsigned long bitbuf=0; @@ -95,3 +101,6 @@ getbits (FILE * const ifp, int nbits) } return ret; } + + + |