Hello community,

here is the log from the commit of package jhead for openSUSE:Factory checked 
in at 2013-03-11 10:09:40
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/jhead (Old)
 and      /work/SRC/openSUSE:Factory/.jhead.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "jhead", Maintainer is "[email protected]"

Changes:
--------
--- /work/SRC/openSUSE:Factory/jhead/jhead.changes      2012-07-02 
21:22:48.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.jhead.new/jhead.changes 2013-03-11 
10:09:41.000000000 +0100
@@ -1,0 +2,8 @@
+Sun Mar 10 19:16:12 UTC 2013 - [email protected]
+
+- Update to version 2.97
+  * Add feature to show quality of jpeg, (by Andy Spiegel)
+  * Fix crash on some corrupt files bug, clarify time adjustment
+    syntax in help 
+
+-------------------------------------------------------------------

Old:
----
  jhead-2.96.tar.gz

New:
----
  jhead-2.97.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ jhead.spec ++++++
--- /var/tmp/diff_new_pack.Pbw2X0/_old  2013-03-11 10:09:43.000000000 +0100
+++ /var/tmp/diff_new_pack.Pbw2X0/_new  2013-03-11 10:09:43.000000000 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package jhead
 #
-# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany.
+# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -17,7 +17,7 @@
 
 
 Name:           jhead
-Version:        2.96
+Version:        2.97
 Release:        0
 Requires:       %{_bindir}/jpegtran
 Requires:       %{_bindir}/mogrify

++++++ jhead-2.96.tar.gz -> jhead-2.97.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/jhead-2.96/changes.txt new/jhead-2.97/changes.txt
--- old/jhead-2.96/changes.txt  2012-06-22 17:00:21.000000000 +0200
+++ new/jhead-2.97/changes.txt  2013-01-30 18:02:56.000000000 +0100
@@ -384,4 +384,19 @@
 Fix printing file info when -ft option is used
 Do not skip readonle files with -st option
 
--------Released version 2.96 -- Jun 22 2012 --------
\ No newline at end of file
+-------Released version 2.96 -- Jun 22 2012 --------
+
+Jul 9 2012:
+Make it compile clean with visual studio 10
+
+Jul 28 2012:
+Various cleanups from debian folks.
+
+Oct 19 2012:
+Add feature to show quality of jpeg, (by Andy Spiegel)
+
+Dec 27 2012:
+Fix crash on some corrupt files bug, clarify time adjustment syntax in help
+
+
+-------Released version 2.97 -- Jan 30 2013 --------
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/jhead-2.96/exif.c new/jhead-2.97/exif.c
--- old/jhead-2.96/exif.c       2012-06-22 17:00:21.000000000 +0200
+++ new/jhead-2.97/exif.c       2013-01-30 18:02:56.000000000 +0100
@@ -823,10 +823,6 @@
 
             case TAG_ISO_EQUIVALENT:
                 ImageInfo.ISOequivalent = (int)ConvertAnyFormat(ValuePtr, 
Format);
-                if ( ImageInfo.ISOequivalent < 50 ){
-                    // Fixes strange encoding on some older digicams.
-                    ImageInfo.ISOequivalent *= 200;
-                }
                 break;
 
             case TAG_DIGITALZOOMRATIO:
@@ -868,7 +864,7 @@
                     if (SubdirStart < OffsetBase || SubdirStart > 
OffsetBase+ExifLength){
                         ErrNonfatal("Illegal GPS directory link in Exif",0,0);
                     }else{
-                        ProcessGpsInfo(SubdirStart, ByteCount, OffsetBase, 
ExifLength);
+                        ProcessGpsInfo(SubdirStart, OffsetBase, ExifLength);
                     }
                     continue;
                 }
@@ -1052,7 +1048,7 @@
 
 
     // Compute the CCD width, in millimeters.
-    if (FocalplaneXRes != 0){
+    if (FocalplaneXRes != 0 && ExifImageWidth != 0){
         // Note: With some cameras, its not possible to compute this correctly 
because
         // they don't adjust the indicated focal plane resolution units when 
using less
         // than maximum resolution, so the CCDWidth value comes out too small. 
 Nothing
@@ -1245,52 +1241,6 @@
     return OrientTab[ImageInfo.Orientation];
 }
 
-
-
-//--------------------------------------------------------------------------
-// Remove thumbnail out of the exif image.
-//--------------------------------------------------------------------------
-int RemoveThumbnail(unsigned char * ExifSection)
-{
-    if (!DirWithThumbnailPtrs || 
-        ImageInfo.ThumbnailOffset == 0 || 
-        ImageInfo.ThumbnailSize == 0){
-        // No thumbnail, or already deleted it.
-        return 0;
-    }
-    if (ImageInfo.ThumbnailAtEnd == FALSE){
-        ErrNonfatal("Thumbnail not at end of Exif header, can't remove it", 0, 
0);
-        return 0;
-    }
-
-    {
-        int de;
-        int NumDirEntries;
-        NumDirEntries = Get16u(DirWithThumbnailPtrs);
-
-        for (de=0;de<NumDirEntries;de++){
-            int Tag;
-            unsigned char * DirEntry;
-            DirEntry = DIR_ENTRY_ADDR(DirWithThumbnailPtrs, de);
-            Tag = Get16u(DirEntry);
-            if (Tag == TAG_THUMBNAIL_LENGTH){
-                // Set length to zero.
-                if (Get16u(DirEntry+2) != FMT_ULONG){
-                    // non standard format encoding.  Can't do it.
-                    ErrNonfatal("Can't remove Exif thumbnail", 0, 0);
-                    return 0;
-                }
-                Put32u(DirEntry+8, 0);
-            }                    
-        }
-    }
-
-    // This is how far the non thumbnail data went.
-    return ImageInfo.ThumbnailOffset+8;
-
-}
-
-
 //--------------------------------------------------------------------------
 // Convert exif time to Unix time structure
 //--------------------------------------------------------------------------
@@ -1555,7 +1505,7 @@
     if (ImageInfo.Process != M_SOF0){
         // don't show it if its the plain old boring 'baseline' process, but do
         // show it if its something else, like 'progressive' (used on web 
sometimes)
-        int a;
+        unsigned a;
         for (a=0;;a++){
             if (a >= PROCESS_TABLE_SIZE){
                 // ran off the end of the table.
@@ -1575,6 +1525,10 @@
         if (ImageInfo.GpsAlt[0]) printf("GPS Altitude : 
%s\n",ImageInfo.GpsAlt);
     }
 
+    if (ImageInfo.QualityGuess){
+        printf("JPEG Quality : %d\n", ImageInfo.QualityGuess);
+    }
+
     // Print the comment. Print 'Comment:' for each new line of comment.
     if (ImageInfo.Comments[0]){
         int a,c;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/jhead-2.96/gpsinfo.c new/jhead-2.97/gpsinfo.c
--- old/jhead-2.96/gpsinfo.c    2012-06-22 17:00:21.000000000 +0200
+++ new/jhead-2.97/gpsinfo.c    2013-01-30 18:02:56.000000000 +0100
@@ -53,7 +53,7 @@
 //--------------------------------------------------------------------------
 // Process GPS info directory
 //--------------------------------------------------------------------------
-void ProcessGpsInfo(unsigned char * DirStart, int ByteCountUnused, unsigned 
char * OffsetBase, unsigned ExifLength)
+void ProcessGpsInfo(unsigned char * DirStart, unsigned char * OffsetBase, 
unsigned ExifLength)
 {
     int de;
     unsigned a;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/jhead-2.96/iptc.c new/jhead-2.97/iptc.c
--- old/jhead-2.96/iptc.c       2012-06-22 17:00:21.000000000 +0200
+++ new/jhead-2.97/iptc.c       2013-01-30 18:02:56.000000000 +0100
@@ -115,7 +115,7 @@
         short  signature;
         unsigned char   type = 0;
         short  length = 0;
-        char * description = NULL;
+        const char * description = NULL;
 
         if (pos+5 > maxpos) goto corrupt;
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/jhead-2.96/jhead.1 new/jhead-2.97/jhead.1
--- old/jhead-2.96/jhead.1      2012-06-22 17:00:21.000000000 +0200
+++ new/jhead-2.97/jhead.1      2013-01-30 18:02:56.000000000 +0100
@@ -1,4 +1,4 @@
-.TH JHEAD 1 "22 Jun 2012" "jhead 2.96"
+.TH JHEAD 1 "30 Jan 2013" "jhead 2.97"
 .SH NAME
 jhead \- Digicam JPEG Exif header manipulation tool
 .SH SYNOPSIS
@@ -190,11 +190,22 @@
 
 .TP
 .B \-ta<+|\-><timediff>
-Adjust time stored in the Exif header by h:mm backwards or forwards.
+Adjust time stored in the Exif header by h:mm forwards or backwards.
 Useful when having taken pictures with the wrong time set on the camera,
 such as after travelling across time zones, or when daylight savings
 time has changed.
 
+Examples:
+
+Add 1 hourand 5 minutes to the time
+.br
+jhead \-ta+1:05
+
+Decrease time by one second:
+.br
+jhead \-ta-0:0:1
+
+
 This option changes all Date/time fields in the exif header, including
 "DateTimeOriginal" (tag 0x9003) and "DateTimeDigitized" (tag 0x9004).
 .TP
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/jhead-2.96/jhead.c new/jhead-2.97/jhead.c
--- old/jhead-2.96/jhead.c      2012-06-22 17:00:21.000000000 +0200
+++ new/jhead-2.97/jhead.c      2013-01-30 18:02:56.000000000 +0100
@@ -2,28 +2,29 @@
 // Program to pull the information out of various types of EXIF digital 
 // camera files and show it in a reasonably consistent way
 //
-// Version 2.96
+// Version 2.97
 //
 // Compiling under Windows:  
 //   Make sure you have Microsoft's compiler on the path, then run make.bat
 //
-// Dec 1999 - Jun 2012
+// Dec 1999 - Jan 2013
 //
 // by Matthias Wandel   www.sentex.net/~mwandel
 //--------------------------------------------------------------------------
+#ifdef _WIN32
+    #include <io.h>
+#endif
+
 #include "jhead.h"
 
 #include <sys/stat.h>
 
-#define JHEAD_VERSION "2.96"
+#define JHEAD_VERSION "2.97"
 
 // This #define turns on features that are too very specific to 
 // how I organize my photos.  Best to ignore everything inside #ifdef MATTHIAS
 //#define MATTHIAS
 
-#ifdef _WIN32
-    #include <io.h>
-#endif
 
 // Bitmasks for DoModify:
 #define MODIFY_ANY  1
@@ -31,7 +32,7 @@
 #define JPEGS_ONLY  4
 #define MODIFY_JPEG 5
 #define READ_JPEG   6
-static int DoModify     = FALSE;
+static int DoModify  = FALSE;
 
 
 static int FilesMatched;
@@ -108,7 +109,7 @@
 //--------------------------------------------------------------------------
 // Error exit handler
 //--------------------------------------------------------------------------
-void ErrFatal(char * msg)
+void ErrFatal(const char * msg)
 {
     fprintf(stderr,"\nError : %s\n", msg);
     if (CurrentFile) fprintf(stderr,"in file '%s'\n",CurrentFile);
@@ -119,7 +120,7 @@
 // Report non fatal errors.  Now that microsoft.net modifies exif headers,
 // there's corrupted ones, and there could be more in the future.
 //--------------------------------------------------------------------------
-void ErrNonfatal(char * msg, int a1, int a2)
+void ErrNonfatal(const char * msg, int a1, int a2)
 {
     if (SupressNonFatalErrors) return;
 
@@ -267,7 +268,7 @@
 
     if (!HasScandate && !ImageInfo.DateTime[0]){
         // Scan date is not in the file yet, and it doesn't have one built in. 
 Add it.
-        char Temp[30];
+        char Temp[40];
         sprintf(Temp, "scan_date=%s", ctime(&ImageInfo.FileDateTime));
         strncat(OutComment, Temp, MAX_COMMENT_SIZE-5-strlen(OutComment));
         Modified = TRUE;
@@ -281,20 +282,21 @@
 {
     static char CommandString[PATH_MAX+1];
     double scale;
+    float TargetSize = 1600;
 
     ApplyCommand = CommandString;
 
-    if (ImageInfo.Height <= 1280 && ImageInfo.Width <= 1280){
+    scale = TargetSize / ImageInfo.Width;
+    if (TargetSize / ImageInfo.Height > scale) scale = TargetSize  / 
ImageInfo.Width;
+
+    if (scale > 0.8){
         printf("not resizing %dx%x '%s'\n",ImageInfo.Height, ImageInfo.Width, 
ImageInfo.FileName);
         return FALSE;
     }
 
-    scale = 1024.0 / ImageInfo.Height;
-    if (1024.0 / ImageInfo.Width < scale) scale = 1024.0 / ImageInfo.Width;
-
-    if (scale < 0.5) scale = 0.5; // Don't scale down by more than a factor of 
two.
+    if (scale < 0.4) scale = 0.4; // Don't scale down by too much.
 
-    sprintf(CommandString, "mogrify -geometry %dx%d -quality 85 
&i",(int)(ImageInfo.Width*scale), (int)(ImageInfo.Height*scale));
+    sprintf(CommandString, "mogrify -geometry %dx%d -quality 80 
&i",(int)(ImageInfo.Width*scale), (int)(ImageInfo.Height*scale));
     return TRUE;
 }
 
@@ -774,7 +776,7 @@
 //--------------------------------------------------------------------------
 // Do selected operations to one file at a time.
 //--------------------------------------------------------------------------
-void ProcessFile(const char * FileName)
+static void ProcessFile(const char * FileName)
 {
     int Modified = FALSE;
     ReadMode_t ReadMode;
@@ -1205,7 +1207,7 @@
 static void Usage (void)
 {
     printf("Jhead is a program for manipulating settings and thumbnails in 
Exif jpeg headers\n"
-           "used by most Digital Cameras.  v"JHEAD_VERSION" Matthias Wandel, 
Jun 22 2012.\n"
+           "used by most Digital Cameras.  v"JHEAD_VERSION" Matthias Wandel, 
Jan 30 2013.\n"
            "http://www.sentex.net/~mwandel/jhead\n";
            "\n");
 
@@ -1260,7 +1262,7 @@
            "             Use together with -n to rename .AVI files from exif 
in .THM files\n"
            "             for example\n"
            "  -ta<+|->h[:mm[:ss]]\n"
-           "             Adjust time by h:mm backwards or forwards.  Useful 
when having\n"
+           "             Adjust time by h:mm forwards or backwards.  Useful 
when having\n"
            "             taken pictures with the wrong time set on the camera, 
such as when\n"
            "             traveling across time zones or DST changes. Dates can 
be adjusted\n"
            "             by offsetting by 24 hours or more.  For large date 
adjustments,\n"
@@ -1360,7 +1362,7 @@
 //--------------------------------------------------------------------------
 // Parse specified date or date+time from command line.
 //--------------------------------------------------------------------------
-time_t ParseCmdDate(char * DateSpecified)
+static time_t ParseCmdDate(char * DateSpecified)
 {
     int a;
     struct tm tm;
@@ -1584,7 +1586,7 @@
             if (c) *c = ' '; // Replace '-' with a space.
             
             if (!Exif2tm(&tm, arg+3)){
-                ErrFatal("-ts option must be followed by time in format 
yyyy:mmm:dd-hh:mm:ss\n"
+                ErrFatal("-ts option must be followed by time in format 
yyyy:mm:dd-hh:mm:ss\n"
                         "Example: jhead -ts2001:01:01-12:00:00 foo.jpg");
             }
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/jhead-2.96/jhead.h new/jhead-2.97/jhead.h
--- old/jhead-2.96/jhead.h      2012-06-22 17:00:21.000000000 +0200
+++ new/jhead-2.97/jhead.h      2013-01-30 18:02:56.000000000 +0100
@@ -6,8 +6,6 @@
 // where they get used as possible, so include files only get stuff that 
 // gets used in more than one file.
 //--------------------------------------------------------------------------
-#define _CRT_SECURE_NO_DEPRECATE 1
-
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -19,6 +17,13 @@
 
 #ifdef _WIN32
     #include <sys/utime.h>
+
+    // Make the Microsoft Visual c 10 deprecate warnings go away.
+    // The _CRT_SECURE_NO_DEPRECATE doesn't do the trick like it should.
+    #define unlink _unlink
+    #define chmod _chmod
+    #define access _access
+    #define mktemp _mktemp
 #else
     #include <utime.h>
     #include <sys/types.h>
@@ -127,6 +132,8 @@
     char GpsLat[31];
     char GpsLong[31];
     char GpsAlt[20];
+
+    int  QualityGuess;
 }ImageInfo_t;
 
 
@@ -144,14 +151,13 @@
 
 
 // prototypes for jhead.c functions
-void ErrFatal(char * msg);
-void ErrNonfatal(char * msg, int a1, int a2);
+void ErrFatal(const char * msg);
+void ErrNonfatal(const char * msg, int a1, int a2);
 void FileTimeAsString(char * TimeStr);
 
 // Prototypes for exif.c functions.
 int Exif2tm(struct tm * timeptr, char * ExifTime);
 void process_EXIF (unsigned char * CharBuf, unsigned int length);
-int RemoveThumbnail(unsigned char * ExifSection);
 void ShowImageInfo(int ShowFileInfo);
 void ShowConciseImageInfo(void);
 const char * ClearOrientation(void);
@@ -187,7 +193,7 @@
                  unsigned char * OffsetBase, unsigned ExifLength);
 
 // gpsinfo.c prototypes
-void ProcessGpsInfo(unsigned char * ValuePtr, int ByteCount, 
+void ProcessGpsInfo(unsigned char * ValuePtr,  
                 unsigned char * OffsetBase, unsigned ExifLength);
 
 // iptc.c prototpyes
@@ -218,6 +224,9 @@
 Section_t * CreateSection(int SectionType, unsigned char * Data, int size);
 void ResetJpgfile(void);
 
+// Prototypes from jpgqguess.c
+void process_DQT (const uchar * Data, int length);
+void process_DHT (const uchar * Data, int length);
 
 // Variables from jhead.c used by exif.c
 extern ImageInfo_t ImageInfo;
@@ -249,7 +258,7 @@
 #define M_EXIF  0xE1          // Exif marker.  Also used for XMP data!
 #define M_XMP   0x10E1        // Not a real tag (same value in file as Exif!)
 #define M_COM   0xFE          // COMment 
-#define M_DQT   0xDB
-#define M_DHT   0xC4
+#define M_DQT   0xDB          // Define Quantization Table
+#define M_DHT   0xC4          // Define Huffmann Table
 #define M_DRI   0xDD
 #define M_IPTC  0xED          // IPTC marker
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/jhead-2.96/jpgfile.c new/jhead-2.97/jpgfile.c
--- old/jhead-2.96/jpgfile.c    2012-06-22 17:00:21.000000000 +0200
+++ new/jhead-2.97/jpgfile.c    2013-01-30 18:02:56.000000000 +0100
@@ -98,7 +98,7 @@
 //--------------------------------------------------------------------------
 // Check sections array to see if it needs to be increased in size.
 //--------------------------------------------------------------------------
-void CheckSectionsAllocated(void)
+static void CheckSectionsAllocated(void)
 {
     if (SectionsRead > SectionsAllocated){
         ErrFatal("allocation screwup");
@@ -143,6 +143,9 @@
         for (a=0;;a++){
             marker = fgetc(infile);
             if (marker != 0xff && prev == 0xff) break;
+            if (marker == EOF){
+                ErrFatal("Unexpected end of file");
+            }
             prev = marker;
         }
 
@@ -155,6 +158,9 @@
         // Read the length of the section.
         lh = fgetc(infile);
         ll = fgetc(infile);
+        if (lh == EOF || ll == EOF){
+            ErrFatal("Unexpected end of file");
+        }
 
         itemlen = (lh << 8) | ll;
 
@@ -212,6 +218,17 @@
                 }
                 return TRUE;
 
+            case M_DQT:
+                // Use for jpeg quality guessing
+                process_DQT(Data, itemlen);
+                break;
+
+            case M_DHT:   
+                // Use for jpeg quality guessing
+                process_DHT(Data, itemlen);
+                break;
+
+
             case M_EOI:   // in case it's a tables-only JPEG stream
                 fprintf(stderr,"No image in jpeg!\n");
                 return FALSE;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/jhead-2.96/jpgqguess.c new/jhead-2.97/jpgqguess.c
--- old/jhead-2.96/jpgqguess.c  1970-01-01 01:00:00.000000000 +0100
+++ new/jhead-2.97/jpgqguess.c  2013-01-30 18:02:56.000000000 +0100
@@ -0,0 +1,207 @@
+//--------------------------------------------------------------------------
+// Program to pull the information out of various types of EXIF digital 
+// camera files and show it in a reasonably consistent way
+//
+// This module handles guessing of jpeg quality from quantization table
+//
+// Using code from Andy Spiegl
+//--------------------------------------------------------------------------
+#include "jhead.h"
+
+
+ 
+
+// for the DQT marker -- start --
+// Sample quantization tables from JPEG spec --- only needed for
+// guesstimate of quality factor.  Note these are in zigzag order.
+
+static int std_luminance_quant_tbl[64] = {
+    16,  11,  12,  14,  12,  10,  16,  14,
+    13,  14,  18,  17,  16,  19,  24,  40,
+    26,  24,  22,  22,  24,  49,  35,  37,
+    29,  40,  58,  51,  61,  60,  57,  51,
+    56,  55,  64,  72,  92,  78,  64,  68,
+    87,  69,  55,  56,  80, 109,  81,  87,
+    95,  98, 103, 104, 103,  62,  77, 113,
+   121, 112, 100, 120,  92, 101, 103,  99
+};
+
+static int std_chrominance_quant_tbl[64] = {
+    17,  18,  18,  24,  21,  24,  47,  26,
+    26,  47,  99,  66,  56,  66,  99,  99,
+    99,  99,  99,  99,  99,  99,  99,  99,
+    99,  99,  99,  99,  99,  99,  99,  99,
+    99,  99,  99,  99,  99,  99,  99,  99,
+    99,  99,  99,  99,  99,  99,  99,  99,
+    99,  99,  99,  99,  99,  99,  99,  99,
+    99,  99,  99,  99,  99,  99,  99,  99
+};
+
+static int *deftabs[2] =
+    { std_luminance_quant_tbl, std_chrominance_quant_tbl };
+
+// jpeg_zigzag_order[i] is the zigzag-order position of the i'th element
+// of a DCT block read in natural order (left to right, top to bottom).
+
+static int jpeg_zigzag_order[64] = {
+     0,  1,  5,  6, 14, 15, 27, 28,
+     2,  4,  7, 13, 16, 26, 29, 42,
+     3,  8, 12, 17, 25, 30, 41, 43,
+     9, 11, 18, 24, 31, 40, 44, 53,
+    10, 19, 23, 32, 39, 45, 52, 54,
+    20, 22, 33, 38, 46, 51, 55, 60,
+    21, 34, 37, 47, 50, 56, 59, 61,
+    35, 36, 48, 49, 57, 58, 62, 63
+};
+// for the DQT marker -- end --
+
+
+
+
+
+//--------------------------------------------------------------------------
+// Process an DQT (Define Quantization Table) marker.
+//
+// Code mostly "stolen" from jpegdump:
+//  Copyright (c) 1992 Handmade Software, Inc.
+//  by Allan N. Hessenflow
+//
+// We want to print out the "Approximate quality factor"
+//--------------------------------------------------------------------------
+//
+// The numbers printed in the `Approximate quality factor' line are as follows:
+//  Quality: an estimate of the quality factor used when cjpeg was run.
+//    Scaling factor (scale): mean ratio between quantization table entries
+//    and JPEG sample table entries, times 100.
+//  Variance (var): squared standard deviation of the above ratio.
+//    If this is larger than about 2, then the table is not a simple
+//    multiple of the standard's sample table, so the file was NOT
+//    generated by cjpeg and the quality estimate is dubious.
+//--------------------------------------------------------------------------
+ void process_DQT (const uchar * Data, int length)
+{
+    int a;
+    int c;
+    int tableindex, coefindex, row, col;
+    unsigned int table[64];
+    int *reftable = NULL;
+    double cumsf = 0.0, cumsf2 = 0.0;
+    int allones = 1;
+
+    a=2; // first two bytes is length
+    while (a<length)
+    {
+        c = Data[a++];
+        tableindex = c & 0x0f;
+        if (ShowTags>1){
+            printf("DQT:  table %d precision %d\n", tableindex, (c>>4) ? 16 : 
8);
+        }
+        if (tableindex < 2){
+            reftable = deftabs[tableindex];
+        }
+
+        // Read in the table, compute statistics relative to reference table 
+        for (coefindex = 0; coefindex < 64; coefindex++) {
+            unsigned int val;
+            if (c>>4) {
+                register unsigned int temp;
+                temp=(unsigned int) (Data[a++]);
+                temp *= 256;
+                val=(unsigned int) Data[a++] + temp;
+            } else {
+                val=(unsigned int) Data[a++];
+            }
+            table[coefindex] = val;
+            if (reftable) {
+                double x;
+                // scaling factor in percent 
+                x = 100.0 * (double)val / (double)reftable[coefindex];
+                cumsf += x;
+                cumsf2 += x * x;
+                // separate check for all-ones table (Q 100)
+                if (val != 1) allones = 0;
+            }
+        }
+        // If requested, print table in normal array order 
+        if (ShowTags>2){
+            for (row=0; row<8; row++) {
+                printf("    ");
+                for (col=0; col<8; col++) {
+                    printf("%5u ", table[jpeg_zigzag_order[row*8+col]]);
+                }
+                printf("\n");
+            }
+        }
+        // Print summary stats 
+        if (reftable) { // terse output includes quality 
+            double qual, var;
+            cumsf /= 64.0;    // mean scale factor 
+            cumsf2 /= 64.0;
+            var = cumsf2 - (cumsf * cumsf); // variance 
+            if (allones){      // special case for all-ones table 
+                qual = 100.0;
+            }else if (cumsf <= 100.0){
+                qual = (200.0 - cumsf) / 2.0;
+            }else{
+                qual = 5000.0 / cumsf;
+            }
+            if (ShowTags>1)  printf("  ");
+
+            if (ShowTags){
+                printf("Approximate quality factor for qtable %d: %.0f (scale 
%.2f, var %.2f)\n",
+                     tableindex, qual, cumsf, var);
+            } else {
+                if (tableindex == 0){
+                    ImageInfo.QualityGuess = (int)(qual+0.5);
+                }
+            }
+        }
+    }
+}
+
+
+//--------------------------------------------------------------------------
+// Process an DHT (Define Huffmann Tables) marker.
+//
+// Code mostly "stolen" from jpegdump:
+//  Copyright (c) 1992 Handmade Software, Inc.
+//  by Allan N. Hessenflow
+//--------------------------------------------------------------------------
+void process_DHT (const uchar * Data, int length)
+{
+    int a, i;
+    int c, c2;
+    unsigned char huff[16];
+
+    if (ShowTags>1){
+        printf("DHT (length %d bytes)\n", length);
+    }
+
+    a=2; // first two bytes is length
+    while (a<length)
+    {
+        c = Data[a++];
+        if (ShowTags>1){
+            printf("  table %d\n", c);
+        }
+        for (i=0; i<16; i++) {
+            huff[i]=(unsigned char) Data[a++];
+        }
+        for (i=0; i<16; i++) {
+            if (ShowTags>2){
+                printf("  bits %2d (codes=%3u) ", i+1, (unsigned int) huff[i]);
+            }
+            while (huff[i]--) {
+                c2 = Data[a++];
+                if (ShowTags>2){
+                    printf("  $%02x ", c2);
+                }
+            }
+            if (ShowTags>2){
+                printf("\n");
+            }
+        }
+    }
+}
+
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/jhead-2.96/makefile new/jhead-2.97/makefile
--- old/jhead-2.96/makefile     2012-06-22 17:00:21.000000000 +0200
+++ new/jhead-2.97/makefile     2013-01-30 18:02:56.000000000 +0100
@@ -3,11 +3,11 @@
 #--------------------------------
 OBJ=.
 SRC=.
-CFLAGS= -O3 -Wall
+CFLAGS:= $(CFLAGS) -O3 -Wall
 
 all: jhead
 
-objs = $(OBJ)/jhead.o $(OBJ)/jpgfile.o $(OBJ)/paths.o \
+objs = $(OBJ)/jhead.o $(OBJ)/jpgfile.o $(OBJ)/jpgqguess.o $(OBJ)/paths.o \
        $(OBJ)/exif.o $(OBJ)/iptc.o $(OBJ)/gpsinfo.o $(OBJ)/makernote.o 
 
 $(OBJ)/%.o:$(SRC)/%.c
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/jhead-2.96/makefile-win32 
new/jhead-2.97/makefile-win32
--- old/jhead-2.96/makefile-win32       2012-06-22 17:00:21.000000000 +0200
+++ new/jhead-2.97/makefile-win32       2013-01-30 18:02:56.000000000 +0100
@@ -3,7 +3,9 @@
 #--------------------------------
 
 CC=cl /nologo
-CFLAGS=-c -G3 -Ox -W3 -Zp -Zd
+CFLAGS=-c -Ox -Os -W3 -Zp -D _CRT_SECURE_NO_WARNINGS
+
+
 LINKER=link
 LINKCON = /nologo
 
@@ -13,6 +15,7 @@
 
 OBJECTS_JHEAD = $(OBJ)\jhead.obj  \
                 $(OBJ)\jpgfile.obj \
+                $(OBJ)\jpgqguess.obj \
                 $(OBJ)\myglob.obj \
                 $(OBJ)\paths.obj \
                 $(OBJ)\exif.obj \
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/jhead-2.96/makernote.c new/jhead-2.97/makernote.c
--- old/jhead-2.96/makernote.c  2012-06-22 17:00:21.000000000 +0200
+++ new/jhead-2.97/makernote.c  2013-01-30 18:02:56.000000000 +0100
@@ -9,7 +9,7 @@
 //--------------------------------------------------------------------------
 // Process exif format directory, as used by Cannon maker note
 //--------------------------------------------------------------------------
-void ProcessCanonMakerNoteDir(unsigned char * DirStart, unsigned char * 
OffsetBase, 
+static void ProcessCanonMakerNoteDir(unsigned char * DirStart, unsigned char * 
OffsetBase, 
         unsigned ExifLength)
 {
     int de;
@@ -154,7 +154,7 @@
 //--------------------------------------------------------------------------
 // Show generic maker note - just hex bytes.
 //--------------------------------------------------------------------------
-void ShowMakerNoteGeneric(unsigned char * ValuePtr, int ByteCount)
+static void ShowMakerNoteGeneric(unsigned char * ValuePtr, int ByteCount)
 {
     int a;
     for (a=0;a<ByteCount;a++){
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/jhead-2.96/myglob.c new/jhead-2.97/myglob.c
--- old/jhead-2.96/myglob.c     2012-06-22 17:00:21.000000000 +0200
+++ new/jhead-2.97/myglob.c     2013-01-30 18:02:56.000000000 +0100
@@ -17,6 +17,7 @@
 #include <io.h>
 #include "jhead.h"
 
+
 #define TRUE 1
 #define FALSE 0
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/jhead-2.96/paths.c new/jhead-2.97/paths.c
--- old/jhead-2.96/paths.c      2012-06-22 17:00:21.000000000 +0200
+++ new/jhead-2.97/paths.c      2013-01-30 18:02:56.000000000 +0100
@@ -12,7 +12,7 @@
 #include <sys/stat.h>
 #ifdef _WIN32
     #include <direct.h> // for mkdir under windows.
-    #define mkdir(dir,mode) mkdir(dir)
+    #define mkdir(dir,mode) _mkdir(dir)
     #define S_ISDIR(a)   (a & _S_IFDIR)
 #endif
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/jhead-2.96/usage.html new/jhead-2.97/usage.html
--- old/jhead-2.96/usage.html   2012-06-22 17:00:21.000000000 +0200
+++ new/jhead-2.97/usage.html   2013-01-30 18:02:56.000000000 +0100
@@ -8,7 +8,7 @@
 or Mac OS-X won't do anything for you - you have to <b>use it from the Command 
prompt</b> 
 
 
-<h3>Jhead v2.96 program Features</h3>
+<h3>Jhead v2.97 program Features</h3>
 <ul>
 <li>Extracting camera settings from Exif image files
 <li>Able to set and/or adjust the Exif time field
@@ -161,7 +161,7 @@
     files or raw files with jpeg files.  Use together with '-n' option.
 
 <tr valign=top><td><b>-ta&lt;timediff&gt;
-<td>Adjust time stored in the Exif header by h:mm backwards or forwards.  
Useful when having
+<td>Adjust time stored in the Exif header by h:mm forwards or backwards.  
Useful when having
     taken pictures with the wrong time set on the camera, such as after 
travelling across
     time zones, or when daylight savings time has changed.
     This option uses the time from the "DateTimeOriginal" (tag 0x9003) field, 
but sets
@@ -454,6 +454,7 @@
 </ul>
 <p><br>
 Jhead homeage: <a 
href="http://www.sentex.net/~mwandel/jhead";>http://www.sentex.net/~mwandel/jhead</a><br>
-Last Updated: Jun 22 2012
+Last Updated: Jan 30 2013<p>
+
 
 

-- 
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to