SOURCES: dcraw.1, dcraw.c - 8.74

blues blues at pld-linux.org
Fri Jun 8 15:42:09 CEST 2007


Author: blues                        Date: Fri Jun  8 13:42:09 2007 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- 8.74

---- Files affected:
SOURCES:
   dcraw.1 (1.5 -> 1.6) , dcraw.c (1.7 -> 1.8) 

---- Diffs:

================================================================
Index: SOURCES/dcraw.1
diff -u SOURCES/dcraw.1:1.5 SOURCES/dcraw.1:1.6
--- SOURCES/dcraw.1:1.5	Thu Nov 10 21:50:06 2005
+++ SOURCES/dcraw.1	Fri Jun  8 15:42:04 2007
@@ -1,7 +1,7 @@
 .\"
-.\" Man page for dcraw (Raw Photo Decoder)
+.\" Man page for dcraw
 .\"
-.\" Copyright (c) 2005 by David Coffin
+.\" Copyright (c) 2007 by David Coffin
 .\"
 .\" You may distribute without restriction.
 .\"
@@ -9,174 +9,236 @@
 .\" dcoffin a cybercom o net
 .\" http://www.cybercom.net/~dcoffin
 .\"
-.TH dcraw 1 "September 29, 2005"
+.TH dcraw 1 "June 8, 2007"
 .LO 1
 .SH NAME
-dcraw - convert raw digital photos to PPM format
+dcraw - command-line decoder for raw digital photos
 .SH SYNOPSIS
-.B dcraw 
+.B dcraw
 [\fIOPTION\fR]... [\fIFILE\fR]...
 .SH DESCRIPTION
 .B dcraw
-converts raw digital photos to
-.BR ppm (5)
-format.
+decodes raw photos, displays metadata, and extracts thumbnails.
 .SH OPTIONS
 .TP
 .B -v
-Print verbose messages.  The default is to print only warnings
-and errors.
+Print verbose messages, not just warnings and errors.
+.TP
+.B -c
+Write decoded images or thumbnails to standard output.
+.TP
+.B -e
+Extract the camera-generated thumbnail, not the raw image.
+You'll get either a JPEG or a PPM file, depending on the camera.
 .TP
 .B -z
-Change the access and modification times of a JPEG or raw file to
-when the photo was taken, assuming that the camera clock was set
-to Universal Time.
+Change the access and modification times of an AVI, JPEG or raw
+file to when the photo was taken, assuming that the camera clock
+was set to Universal Time.
 .TP
 .B -i
 Identify files but don't decode them.
 Exit status is 0 if
 .B dcraw
 can decode the last file, 1 if it can't.
+.B -i -v
+shows metadata.
 .TP
 .B ""
 .B dcraw
 cannot decode JPEG files!!
 .TP
-.B -c
-Write binary image data to standard output.
-By default,
-.B dcraw
-creates files with a ".ppm" extension.
-.TP
 .B -d
 Show the raw data as a grayscale image with no interpolation.
 Good for photographing black-and-white documents.
 .TP
-.B -q [0-3]
-Set the interpolation quality (default is 3):
-
-.B \t0
-\ \ Bilinear (very fast, low quality)
-.br
-.B \t1
-\ \ Reserved
-.br
-.B \t2
-\ \ Variable Number of Gradients (VNG)
-.br
-.B \t3
-\ \ Adaptive Homogeneity-Directed (AHD)
+.B -D
+Same as
+.BR -d ,
+but totally raw (no color scaling).
 .TP
 .B -h
-Output a half-size image.  Twice as fast as
+Output a half-size color image.  Twice as fast as
 .BR -q\ 0 .
 .TP
-.B -f
-Interpolate RGB as four colors.  This blurs the image a little,
-but it eliminates false 2x2 mesh patterns.
+.B -q 0
+Use high-speed, low-quality bilinear interpolation.
 .TP
-.B -B sigma_domain sigma_range
-Use a bilateral filter to smooth noise while preserving edges.
-.B sigma_domain
-is in units of pixels, while
-.B sigma_range
-is in units of CIELab colorspace.
-Try
-.B -B\ 2\ 4
-to start.
+.B -q 1
+Use Variable Number of Gradients (VNG) interpolation.
 .TP
-.B -a
-Automatic color balance.  The default is to use a fixed
-color balance based on a white card photographed in sunlight.
+.B -q 2
+Use Patterned Pixel Grouping (PPG) interpolation.
 .TP
-.B -w
-Use the color balance specified by the camera.
-If this can't be found,
-.B dcraw
-prints a warning and reverts to the default.
+.B -q 3
+Use Adaptive Homogeneity-Directed (AHD) interpolation.
+.TP
+.B -f
+Interpolate RGB as four colors.  Use this if the output shows
+false 2x2 meshes with VNG or mazes with AHD.
 .TP
-.B -r red_mul -l blue_mul
-Further adjust the color balance by multiplying the red and
-blue output channels by these values.  Both default to 1.0.
+.B -n noise_threshold
+Use wavelets to erase noise while preserving real detail.
+The best threshold should be somewhere between 100 and 1000.
 .TP
 .B -b brightness
-Change the output brightness.  Default is 1.0.
+By default,
+.B dcraw
+writes 8-bit PGM/PPM/PAM with a BT.709 gamma curve and a
+99th-percentile white point.  If the result is too light or
+too dark,
+.B -b
+lets you adjust it.  Default is 1.0.
+.TP
+.B -4
+Write 16-bit linear pseudo-PGM/PPM/PAM with no gamma curve,
+no white point, and no
+.B -b
+option.
+.TP
+.B -T
+Write TIFF output (with metadata) instead of PGM/PPM/PAM.
 .TP
 .B -k black
 Set the black point.  Default depends on the camera.
 .TP
-.B -n
-By default,
-.B dcraw
-clips all colors to prevent pink hues in the highlights.
-Combine this option with
-.B -b 0.25
-to leave the image data completely unclipped.
+.B -K darkframe.pgm
+Subtract a dark frame from the raw data.  To generate a
+dark frame, shoot a raw photo with no light and do
+.BR dcraw\ -D\ -4\ -j\ -t\ 0 .
+.TP
+.B -w
+Use the white balance specified by the camera.
+If this is not found, print a warning and use another method.
+.TP
+.B -a
+Calculate the white balance by averaging the entire image.
+.TP
+.B -A left top width height
+Calculate the white balance by averaging a rectangular area.
+First do
+.B dcraw\ -j\ -t\ 0
+and select an area of neutral grey color.
+.TP
+.B -r mul0 mul1 mul2 mul3
+Specify your own raw white balance.
+These multipliers can be cut and pasted from the output of
+.BR dcraw\ -v .
+.TP
+no white balance option
+Use a fixed white balance based on a color chart illuminated
+with a standard D65 lamp.
+.TP
+.B -M
+If the raw metadata contains a color matrix, don't use it.
+This option only affects Olympus, Leaf, and Phase One cameras.
+.TP
+.B -C red_mag blue_mag
+Enlarge the raw red and blue layers by the given factors,
+typically 0.999 to 1.001, to correct chromatic aberration.
+.TP
+.B -H 0
+Clip all highlights to solid white (default).
+.TP
+.B -H 1
+Leave highlights unclipped in various shades of pink.
+.TP
+.B -H 2
+Blend clipped and unclipped values together for a gradual fade to white.
+.TP
+.B -H 3-9
+Reconstruct highlights.  Low numbers favor whites; high numbers
+favor colors.  Try
+.B -H 5
+as a compromise.  If that's not good enough, do
+.BR -H\ 9 ,
+cut out the non-white highlights, and paste them into an image
+generated with
+.BR -H\ 3 .
 .TP
 .B -m
-Write raw camera colors to the output file.  By default,
-.B dcraw
-converts to sRGB colorspace.
+Same as
+.BR -o\ 0 .
 .TP
-.B -j
-For Fuji\ Super\ CCD cameras, show the image tilted 45 degrees
-so that each output pixel corresponds to one raw pixel.
+.B -o [0-5]
+Select the output colorspace when the
+.B -p
+option is not used:
+
+.B \t0
+\ \ Raw color (unique to each camera)
+.br
+.B \t1
+\ \ sRGB D65 (default)
+.br
+.B \t2
+\ \ Adobe RGB (1998) D65
+.br
+.B \t3
+\ \ Wide Gamut RGB D65
+.br
+.B \t4
+\ \ Kodak ProPhoto RGB D65
+.br
+.B \t5
+\ \ XYZ
 .TP
-.B -s
-For Fuji\ Super\ CCD\ SR cameras, use the secondary sensors, in
-effect underexposing the image by four stops to reveal detail
-in the highlights.
+.BR -p\ camera.icm \ [\  -o\ output.icm \ ]
+Use ICC profiles to define the camera's raw colorspace and the
+desired output colorspace (sRGB by default).
+.TP
+.B -p embed
+Use the ICC profile embedded in the raw photo.
+.TP
+.B -t [0-7,90,180,270]
+Flip the output image.  By default,
+.B dcraw
+applies the flip specified by the camera.
+.B -t 0
+disables all flipping.
+.TP
+.B -s [0-99]
+Select which raw image to decode if the file contains more than one.
+For example, Fuji\ Super\ CCD\ SR cameras generate a second image
+underexposed four stops to show detail in the highlights.
 .TP
-.B ""
-For all other cameras,
 .B -j
-and
+For Fuji\ Super\ CCD cameras, show the image tilted 45 degrees.
+For cameras with non-square pixels, do not stretch the image to
+its correct aspect ratio.  In any case, this option guarantees
+that each output pixel corresponds to one raw pixel.
+.TP
+.B ""
+If they don't apply to your camera,
 .B -s
+and
+.B -j
 are silently ignored.
+.SH FILES
 .TP
-.B -t [0-7]
-Flip the output image.  The most common flips are 5
-(90 degrees CCW) and 6 (90 degrees clockwise).  By default,
-dcraw tries to use the flip specified by the camera.
-.RB \^" -t\ 0 \^"
-forces
-.B dcraw
-not to flip images.
-.TP
-.B -2
-Write eight bits per color value with a 99th-percentile white
-point and the standard 0.45 gamma curve.  Double the height if
-necessary to correct the aspect ratio.  This is the default.
-.TP
-.B -4
-Write sixteen bits per color value.  Output is linear with
-input -- no white point, no gamma, same aspect ratio.
-.TP
-.B -3
-Same image as
-.BR -4 ,
-written in Adobe PhotoShop format.  File extension is ".psd".
+\:./.badpixels, ../.badpixels, ../../.badpixels, ...
+List of your camera's dead pixels, so that
+.B dcraw
+can interpolate around them.  Each line specifies the column,
+row, and UNIX time of death for one pixel.  For example:
+.sp 1
+.nf
+ 962   91 1028350000  # died between August 1 and 4, 2002
+1285 1067 0           # don't know when this pixel died
+.fi
+.sp 1
+These coordinates are before any cropping or rotation, so use
+.B dcraw -j -t 0
+to locate dead pixels.
 .SH "SEE ALSO"
+.BR pgm (5),
 .BR ppm (5),
-.BR ppm2tiff (1),
+.BR pam (5),
+.BR pnmgamma (1),
 .BR pnmtotiff (1),
 .BR pnmtopng (1),
 .BR gphoto2 (1),
+.BR cjpeg (1),
 .BR djpeg (1)
-.SH BUGS
-The
-.B -w
-option does not work with many cameras.
-.P
-No attempt is made to save camera settings or thumbnail images.
-.P
-The author stubbornly refuses to add more output formats.
-.P
-Don't expect
-.B dcraw
-to produce the same images as software provided by the camera
-vendor.  Sometimes
-.B dcraw
-gives better results!
 .SH AUTHOR
 Written by David Coffin, dcoffin a cybercom o net

================================================================
Index: SOURCES/dcraw.c
diff -u SOURCES/dcraw.c:1.7 SOURCES/dcraw.c:1.8
--- SOURCES/dcraw.c:1.7	Thu Nov 23 13:27:03 2006
+++ SOURCES/dcraw.c	Fri Jun  8 15:42:04 2007
@@ -1,29 +1,28 @@
 /*
    dcraw.c -- Dave Coffin's raw photo decoder
-   Copyright 1997-2006 by Dave Coffin, dcoffin a cybercom o net
+   Copyright 1997-2007 by Dave Coffin, dcoffin a cybercom o net
 
    This is a command-line ANSI C program to convert raw photos from
    any digital camera on any computer running any operating system.
 
-   Attention!  Some parts of this program are restricted under the
-   terms of the GNU General Public License.  Such code is enclosed
-   in "BEGIN GPL BLOCK" and "END GPL BLOCK" declarations.
-   Any code not declared GPL is free for all uses.
-
-   Starting in Revision 1.237, the code to support Foveon cameras
-   is under GPL.
-
-   To lawfully redistribute dcraw.c, you must either (a) include
-   full source code for all executable files containing restricted
-   functions, (b) remove these functions, re-implement them, or
-   copy them from an earlier, non-GPL Revision of dcraw.c, or (c)
-   purchase a license from the author.
+   No license is required to download and use dcraw.c.  However,
+   to lawfully redistribute this code, you must either (a) include
+   full source code* for all executable files containing RESTRICTED
+   functions, (b) remove all RESTRICTED functions, re-implement them,
+   or copy them from an earlier, unrestricted Revision of dcraw.c,
+   or (c) purchase a license from the author.
+
+   The functions that process Foveon images have been RESTRICTED
+   since Revision 1.237.  All other code remains free for all uses.
+
+   *If you have not modified dcraw.c in any way, a link to my
+   homepage qualifies as "full source code".
 
    $Revision$
    $Date$
  */
 
-#define VERSION "8.43"
+#define VERSION "8.74"
 
 #define _GNU_SOURCE
 #define _USE_MATH_DEFINES
@@ -48,7 +47,15 @@
 #ifndef NO_LCMS
 #include <lcms.h>
 #endif
-
+#ifdef LOCALEDIR
+#include <libintl.h>
+#define _(String) gettext(String)
+#else
+#define _(String) (String)
+#endif
+#ifndef DJGPP
+#define fgetc getc_unlocked
+#endif
 #ifdef __CYGWIN__
 #include <io.h>
 #endif
@@ -57,6 +64,7 @@
 #include <winsock2.h>
 #pragma comment(lib, "ws2_32.lib")
 #define strcasecmp stricmp
+#define strncasecmp strnicmp
 typedef __int64 INT64;
 typedef unsigned __int64 UINT64;
 #else
@@ -87,25 +95,28 @@
  */
 FILE *ifp;
 short order;
-char *ifname, make[64], model[72], model2[64], *meta_data, cdesc[5];
+char *ifname, *meta_data;
+char cdesc[5], desc[512], make[64], model[64], model2[64], artist[64];
 float flash_used, canon_ev, iso_speed, shutter, aperture, focal_len;
 time_t timestamp;
-unsigned shot_order, kodak_cbpp, filters, unique_id, *oprof;
-int profile_offset, profile_length;
-int thumb_offset, thumb_length, thumb_width, thumb_height, thumb_misc;
-int data_offset, strip_offset, curve_offset, meta_offset, meta_length;
-int tiff_nifds, tiff_flip, tiff_bps, tiff_compress, tile_length;
-int raw_height, raw_width, top_margin, left_margin;
-int height, width, fuji_width, colors, tiff_samples;
-int black, maximum, raw_color, use_gamma;
-int iheight, iwidth, shrink, flip, xmag, ymag;
-int zero_after_ff, is_raw, dng_version, is_foveon;
+unsigned shot_order, kodak_cbpp, filters, exif_cfa, unique_id;
+unsigned profile_offset, profile_length, *oprof;
+unsigned thumb_offset, thumb_length, thumb_misc;
+unsigned data_offset, strip_offset, curve_offset, meta_offset, meta_length;
+unsigned tiff_nifds, tiff_samples, tiff_bps, tiff_compress, tile_length;
+unsigned black, maximum, mix_green, raw_color, use_gamma, zero_is_bad;
+unsigned zero_after_ff, is_raw, dng_version, is_foveon, data_error;
+ushort raw_height, raw_width, height, width, top_margin, left_margin;
+ushort shrink, iheight, iwidth, fuji_width, thumb_width, thumb_height;
+int flip, tiff_flip, colors;
+double pixel_aspect, aber[4]={1,1,1,1};
 ushort (*image)[4], white[8][8], curve[0x1000], cr2_slice[3];
-float bright=1, user_mul[4]={0,0,0,0}, sigma_d=0, sigma_r=0;
-int four_color_rgb=0, document_mode=0, highlight=0;
-int verbose=0, use_auto_wb=0, use_camera_wb=0;
+float bright=1, user_mul[4]={0,0,0,0}, threshold=0;
+int half_size=0, four_color_rgb=0, document_mode=0, highlight=0;
+int verbose=0, use_auto_wb=0, use_camera_wb=0, use_camera_matrix=1;
 int output_color=1, output_bps=8, output_tiff=0;
 int fuji_layout, fuji_secondary, shot_select=0;
+unsigned greybox[4] = { 0, 0, UINT_MAX, UINT_MAX };
 float cam_mul[4], pre_mul[4], rgb_cam[3][4];	/* RGB from camera color */
 const double xyz_rgb[3][3] = {			/* XYZ from RGB */
   { 0.412453, 0.357580, 0.180423 },
@@ -132,7 +143,6 @@
 } ph1;
 
 #define CLASS
-#define fgetc getc_unlocked
 
 #define FORC3 for (c=0; c < 3; c++)
 #define FORC4 for (c=0; c < 4; c++)
@@ -227,7 +237,7 @@
   for (c = haystack; c <= haystack + haystacklen - needlelen; c++)
     if (!memcmp (c, needle, needlelen))
       return c;
-  return NULL;
+  return 0;
 }
 #define memmem my_memmem
 #endif
@@ -235,10 +245,22 @@
 void CLASS merror (void *ptr, char *where)
 {
   if (ptr) return;
-  fprintf (stderr, "%s: Out of memory in %s\n", ifname, where);
+  fprintf (stderr,_("%s: Out of memory in %s\n"), ifname, where);
   longjmp (failure, 1);
 }
 
+void CLASS derror()
+{
+  if (!data_error) {
+    fprintf (stderr, "%s: ", ifname);
+    if (feof(ifp))
+      fprintf (stderr,_("Unexpected end of file\n"));
+    else
+      fprintf (stderr,_("Corrupt data near 0x%lx\n"), ftell(ifp));
+  }
+  data_error = 1;
+}
+
 ushort CLASS sget2 (uchar *s)
 {
   if (order == 0x4949)		/* "II" means little-endian */
@@ -254,7 +276,7 @@
   return sget2(str);
 }
 
-int CLASS sget4 (uchar *s)
+unsigned CLASS sget4 (uchar *s)
 {
   if (order == 0x4949)
     return s[0] | s[1] << 8 | s[2] << 16 | s[3] << 24;
@@ -263,14 +285,14 @@
 }
 #define sget4(s) sget4((uchar *)s)
 
-int CLASS get4()
+unsigned CLASS get4()
 {
   uchar str[4] = { 0xff,0xff,0xff,0xff };
   fread (str, 1, 4, ifp);
   return sget4(str);
 }
 
-int CLASS getint (int type)
+unsigned CLASS getint (int type)
 {
   return type == 3 ? get2() : get4();
 }
@@ -309,7 +331,7 @@
 
 void CLASS read_shorts (ushort *pixel, int count)
 {
-  fread (pixel, 2, count, ifp);
+  if (fread (pixel, 2, count, ifp) < count) derror();
   if ((order == 0x4949) == (ntohs(0x1234) == 0x1234))
     swab (pixel, pixel, count*2);
 }
@@ -397,7 +419,7 @@
       for (i=0; i < 8; i++)
 	total[st][i] += test[i];
       count[st]++;
-next: continue;
+next: ;
     }
   if (count[0] | count[1]) {
     st = count[0]*200 < count[1];
@@ -438,11 +460,9 @@
   static const short mul[4][2] =
   { { 1141,1145 }, { 1128,1109 }, { 1178,1149 }, { 1128,1109 } };
 
-  for (irow=row=0; irow < height; irow++)
-  {
-    fread (data, raw_width * 10 / 8, 1, ifp);
-    for (dp=data, pix=pixel; dp < data+1120; dp+=10, pix+=8)
-    {
+  for (irow=row=0; irow < height; irow++) {
+    if (fread (data, 1, raw_width*5/4, ifp) < raw_width*5/4) derror();
+    for (dp=data, pix=pixel; dp < data+1120; dp+=10, pix+=8) {
       pix[0] = (dp[0] << 2) + (dp[1] >> 6    );
       pix[1] = (dp[2] << 2) + (dp[1] >> 4 & 3);
       pix[2] = (dp[3] << 2) + (dp[1] >> 2 & 3);
@@ -462,8 +482,8 @@
     black = black / ((raw_width - width) * height) - 4;
   for (row=0; row < height; row++)
     for (col=0; col < width; col++) {
-      val = (BAYER(row,col) - black) * mul[row & 3][col & 1] >> 9;
-      if (val < 0) val = 0;
+      if ((val = BAYER(row,col) - black) < 0) val = 0;
+      val = val * mul[row & 3][col & 1] >> 9;
       BAYER(row,col) = val;
     }
   canon_600_fixed_wb(1311);
@@ -473,33 +493,55 @@
   black = 0;
 }
<<Diff was trimmed, longer than 597 lines>>

---- CVS-web:
    http://cvs.pld-linux.org/SOURCES/dcraw.1?r1=1.5&r2=1.6&f=u
    http://cvs.pld-linux.org/SOURCES/dcraw.c?r1=1.7&r2=1.8&f=u



More information about the pld-cvs-commit mailing list