<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">diff --git a/configure.in b/configure.ac
similarity index 100%
rename from configure.in
rename to configure.ac
diff --git a/examples/Makefile.am b/examples/Makefile.am
index e177746..06aa524 100644
--- examples/Makefile.am
+++ examples/Makefile.am
@@ -24,7 +24,7 @@ noinst_PROGRAMS = test-libvideogfx bitstream_output cputest pixmaptest filtertes
 	ppmflip chromatest dynarray symmatrix \
 	$(linuxprogs) $(audioprogs) $(x11progs) # ppm2avi smartpointer
 
-INCLUDES = -I..
+AM_CPPFLAGS = -I..
 
 test_libvideogfx_DEPENDENCIES = ../libvideogfx/libvideogfx.la
 test_libvideogfx_CFLAGS = $(X_CFLAGS)
diff --git a/examples/dynarray.cc b/examples/dynarray.cc
index 623d97a..3d0d88b 100644
--- examples/dynarray.cc
+++ examples/dynarray.cc
@@ -13,7 +13,7 @@ void Show(const DynArray&lt;int&gt;&amp; d)
   cout &lt;&lt; endl;
 }
 
-main()
+int main()
 {
   DynArray&lt;int&gt; dynarray;
   dynarray.SetEmptyValue(-1);
diff --git a/examples/symmatrix.cc b/examples/symmatrix.cc
index d21ab51..0d06ea4 100644
--- examples/symmatrix.cc
+++ examples/symmatrix.cc
@@ -16,7 +16,7 @@ void Show(const SymMatrix&lt;int&gt;&amp; d)
     }
 }
 
-main()
+int main()
 {
   SymMatrix&lt;int&gt; m;
   m.Create(6);
diff --git a/libvideogfx/Makefile.am b/libvideogfx/Makefile.am
index dd37563..97dc5ce 100644
--- libvideogfx/Makefile.am
+++ libvideogfx/Makefile.am
@@ -8,7 +8,7 @@ endif
 
 DIST_SUBDIRS = arch audio utility graphics containers x11
 
-INCLUDES = \
+AM_CPPFLAGS = \
 	-DDATADIR=\"$(datadir)\"	\
 	-DLIBDIR=\"$(libdir)\"		\
 	-DSYSCONFDIR=\"$(sysconfdir)\"	\
diff --git a/libvideogfx/arch/Makefile.am b/libvideogfx/arch/Makefile.am
index c8df929..4244625 100644
--- libvideogfx/arch/Makefile.am
+++ libvideogfx/arch/Makefile.am
@@ -19,5 +19,5 @@ libvideogfx_arch_include_HEADERS = \
 	cpu.hh	\
 	$(mmx_headers)
 
-INCLUDES = \
+AM_CPPFLAGS = \
 	-I$(top_srcdir)
diff --git a/libvideogfx/audio/fileio/Makefile.am b/libvideogfx/audio/fileio/Makefile.am
index 815c628..f7fa586 100644
--- libvideogfx/audio/fileio/Makefile.am
+++ libvideogfx/audio/fileio/Makefile.am
@@ -24,6 +24,6 @@ libvideogfx_audio_fileio_include_HEADERS = \
 	timedsink.hh	\
 	$(linux_headers)
 
-INCLUDES = \
+AM_CPPFLAGS = \
 	-I$(top_srcdir)
 
diff --git a/libvideogfx/containers/Makefile.am b/libvideogfx/containers/Makefile.am
index 78adf30..e1282b2 100644
--- libvideogfx/containers/Makefile.am
+++ libvideogfx/containers/Makefile.am
@@ -2,7 +2,21 @@
 
 noinst_LTLIBRARIES = libvideogfx-containers.la
 
-libvideogfx_containers_includedir = $(includedir)/libvideogfx/containers
+libvideogfx_containers_includedir =  \
+	$(includedir)/libvideogfx/containers
+
+libvideogfx_containers_la_SOURCES = \
+	dummy.cc 	\
+	heap.hh		\
+	heap.icc	\
+	dynarray.hh	\
+	array.hh	\
+	array.icc	\
+	array2.hh	\
+	array2.icc	\
+	symmatrix.hh	\
+	queue.hh	\
+	queue.icc
 
 # Header files for public installation (non-generated)
 libvideogfx_containers_include_HEADERS = \
@@ -17,14 +31,5 @@ libvideogfx_containers_include_HEADERS = \
 	queue.hh	\
 	queue.icc
 
-libvideogfx_containers_la_SOURCES =
-
-INCLUDES = \
+AM_CPPFLAGS = \
 	-I$(top_srcdir)
-
-.PHONY: files
-
-files:
-	@files=`ls $(DISTFILES) 2&gt; /dev/null`; for p in $$files; do \
-	  echo $$p; \
-	done
diff --git a/libvideogfx/containers/dummy.cc b/libvideogfx/containers/dummy.cc
new file mode 100644
index 0000000..5ca23f1
--- /dev/null
+++ libvideogfx/containers/dummy.cc
@@ -0,0 +1,33 @@
+/* A dummy file, to prevent empty libraries from breaking builds.
+   Copyright (C) 2004, 2007, 2009-2012 Free Software Foundation, Inc.
+
+   Copying and distribution of this file, with or without
+   modification, are permitted in any medium without royalty
+   provided the copyright notice and this notice are preserved.  */
+
+/* Some systems, reportedly OpenBSD and Mac OS X, refuse to create
+   libraries without any object files.  You might get an error like:
+
+   &gt; ar cru .libs/libgl.a
+   &gt; ar: no archive members specified
+
+   Compiling this file, and adding its object file to the library, will
+   prevent the library from being empty.  */
+
+/* Some systems, such as Solaris with cc 5.0, refuse to work with libraries
+   that don't export any symbol.  You might get an error like:
+
+   &gt; cc ... libgnu.a
+   &gt; ild: (bad file) garbled symbol table in archive ../gllib/libgnu.a
+
+   Compiling this file, and adding its object file to the library, will
+   prevent the library from exporting no symbols.  */
+
+#ifdef __sun
+/* This declaration ensures that the library will export at least 1 symbol.  */
+int gl_dummy_symbol;
+#else
+/* This declaration is solely to ensure that after preprocessing
+   this file is never empty.  */
+typedef int dummy;
+#endif
diff --git a/libvideogfx/graphics/color/Makefile.am b/libvideogfx/graphics/color/Makefile.am
index 11c8846..bfe83a8 100644
--- libvideogfx/graphics/color/Makefile.am
+++ libvideogfx/graphics/color/Makefile.am
@@ -34,6 +34,5 @@ libvideogfx_graphics_color_include_HEADERS = \
 	img2raw.hh	\
 	colorspace.hh
 
-
-INCLUDES = \
+AM_CPPFLAGS = \
 	-I$(top_srcdir)
diff --git a/libvideogfx/graphics/datatypes/Makefile.am b/libvideogfx/graphics/datatypes/Makefile.am
index 7edf956..30364d5 100644
--- libvideogfx/graphics/datatypes/Makefile.am
+++ libvideogfx/graphics/datatypes/Makefile.am
@@ -18,5 +18,5 @@ libvideogfx_graphics_datatypes_include_HEADERS = \
 	bitmap.hh	\
 	image.hh
 
-INCLUDES = \
+AM_CPPFLAGS = \
 	-I$(top_srcdir)
diff --git a/libvideogfx/graphics/draw/Makefile.am b/libvideogfx/graphics/draw/Makefile.am
index aaa4d66..2b61035 100644
--- libvideogfx/graphics/draw/Makefile.am
+++ libvideogfx/graphics/draw/Makefile.am
@@ -19,5 +19,5 @@ libvideogfx_graphics_draw_include_HEADERS = \
 	blit.hh		\
 	scale.hh
 
-INCLUDES = \
+AM_CPPFLAGS = \
 	-I$(top_srcdir)
diff --git a/libvideogfx/graphics/fileio/Makefile.am b/libvideogfx/graphics/fileio/Makefile.am
index 78fb782..27d094e 100644
--- libvideogfx/graphics/fileio/Makefile.am
+++ libvideogfx/graphics/fileio/Makefile.am
@@ -74,6 +74,6 @@ libvideogfx_graphics_fileio_include_HEADERS = \
 	$(linux_headers) \
 	$(ffmpeg_headers)
 
-INCLUDES = \
+AM_CPPFLAGS = \
 	-I$(top_srcdir)
 
diff --git a/libvideogfx/graphics/fileio/ffmpeg.cc b/libvideogfx/graphics/fileio/ffmpeg.cc
index 6b0a76e..42034b6 100644
--- libvideogfx/graphics/fileio/ffmpeg.cc
+++ libvideogfx/graphics/fileio/ffmpeg.cc
@@ -166,7 +166,7 @@ namespace videogfx
     if (frameRGB)  { av_free(frameRGB); frameRGB=NULL; }
     if (frame)     { av_free(frame); frame=NULL; }
     if (codecCtx)  { avcodec_close(codecCtx); codecCtx=NULL; }
-    if (formatCtx) { av_close_input_file(formatCtx); formatCtx=NULL; }
+    if (formatCtx) { avformat_close_input(&amp;formatCtx); formatCtx=NULL; }
   }
 
 
diff --git a/libvideogfx/graphics/fileio/imagesink.hh b/libvideogfx/graphics/fileio/imagesink.hh
index 915b597..bdc9e9f 100644
--- libvideogfx/graphics/fileio/imagesink.hh
+++ libvideogfx/graphics/fileio/imagesink.hh
@@ -34,7 +34,7 @@
  ********************************************************************************/
 
 #ifndef LIBVIDEOGFX_GRAPHICS_FILEIO_IMAGESINK_HH
-#define LIBVIDEOGFX_GRAPHICS_FILEIO_IMGAESINK_HH
+#define LIBVIDEOGFX_GRAPHICS_FILEIO_IMAGESINK_HH
 
 #include &lt;libvideogfx/graphics/datatypes/image.hh&gt;
 
diff --git a/libvideogfx/graphics/fileio/jpeg.cc b/libvideogfx/graphics/fileio/jpeg.cc
index 1e0e557..25d0187 100644
--- libvideogfx/graphics/fileio/jpeg.cc
+++ libvideogfx/graphics/fileio/jpeg.cc
@@ -73,7 +73,7 @@ namespace videogfx {
     // initialize decompressor
 
     jpeg_create_decompress(&amp;cinfo);
-  
+
     cinfo.err = jpeg_std_error(&amp;jerr);
     jpeg_stdio_src(&amp;cinfo, infile);
 
@@ -156,20 +156,26 @@ namespace videogfx {
               py [cinfo.output_scanline-1][x] = *bufp++;
               pcb[(cinfo.output_scanline-1)/2][x/2] = *bufp++;
               pcr[(cinfo.output_scanline-1)/2][x/2] = *bufp++;
-              py [cinfo.output_scanline-1][x+1] = *bufp++;
+
+              if (x+1 &lt; cinfo.output_width) {
+                py [cinfo.output_scanline-1][x+1] = *bufp++;
+              }
+
               bufp+=2;
             }
 
 
-          (void) jpeg_read_scanlines(&amp;cinfo, buffer, 1);
+          if (cinfo.output_scanline &lt; cinfo.output_height) {
+            (void) jpeg_read_scanlines(&amp;cinfo, buffer, 1);
 
-          bufp = buffer[0];
+            bufp = buffer[0];
 
-          for (unsigned int x=0;x&lt;cinfo.output_width;x++)
-            {
-              py [cinfo.output_scanline-1][x] = *bufp++;
-              bufp+=2;
-            }
+            for (unsigned int x=0;x&lt;cinfo.output_width;x++)
+              {
+                py [cinfo.output_scanline-1][x] = *bufp++;
+                bufp+=2;
+              }
+          }
         }
       }
 
@@ -196,9 +202,15 @@ namespace videogfx {
     // open output file
 
     FILE * outfile;
-    if ((outfile = fopen(filename, "wb")) == NULL) {
-      fprintf(stderr, "can't open %s\n", filename);
-      exit(1);
+
+    if (filename==nullptr) {
+      outfile = stdout;
+    }
+    else {
+      if ((outfile = fopen(filename, "wb")) == NULL) {
+        fprintf(stderr, "can't open %s\n", filename);
+        exit(1);
+      }
     }
 
 
@@ -285,11 +297,13 @@ namespace videogfx {
       }
 
     // cleanup
-    
+
     jpeg_finish_compress(&amp;cinfo);
     jpeg_destroy_compress(&amp;cinfo);
-    
-    fclose(outfile);
+
+    if (filename != nullptr) {
+      fclose(outfile);
+    }
   }
 #endif
 }
diff --git a/libvideogfx/graphics/fileio/png.cc b/libvideogfx/graphics/fileio/png.cc
index 417d43e..52d66c0 100644
--- libvideogfx/graphics/fileio/png.cc
+++ libvideogfx/graphics/fileio/png.cc
@@ -87,7 +87,7 @@ namespace videogfx {
 
   void ReadImage_PNG(Image&lt;Pixel&gt;&amp; img, istream&amp; is)
   {
-    assert(is != NULL); // , "Open stream first.");
+    assert(is.good()); // , "Open stream first.");
 
     png_structp png_ptr;
     png_infop info_ptr;
@@ -135,7 +135,7 @@ namespace videogfx {
 		 &amp;interlace_type, NULL, NULL);
 
     assert(bit_depth &lt; 16); // , "cannot handle 16 bit images");
-      
+
     /**** Set up the data transformations you want.  Note that these are all
      **** optional.  Only call them if you want/need them.  Many of the
      **** transformations only work on specific types of images, and many
@@ -291,7 +291,7 @@ namespace videogfx {
 
     delete[] row_pointers;
   }
-    
+
   void WriteImage_PNG(ostream&amp; os, const Image&lt;Pixel&gt;&amp; img)
   {
     /* Create and initialize the png_struct with the desired error handler
@@ -416,8 +416,8 @@ namespace videogfx {
 	  }
       }
     }
-      
-      
+
+
     png_write_image(png_ptr, row_pointers);
 
     /* It is REQUIRED to call this to finish writing the rest of the file */
diff --git a/libvideogfx/graphics/filters/Makefile.am b/libvideogfx/graphics/filters/Makefile.am
index 7eba05e..6bd69b6 100644
--- libvideogfx/graphics/filters/Makefile.am
+++ libvideogfx/graphics/filters/Makefile.am
@@ -36,5 +36,5 @@ libvideogfx_graphics_filters_include_HEADERS = \
 	resampler.h \
 	$(mmx_headers)
 
-INCLUDES = \
+AM_CPPFLAGS = \
 	-I$(top_srcdir)
diff --git a/libvideogfx/graphics/geometry/Makefile.am b/libvideogfx/graphics/geometry/Makefile.am
index c555cac..b0cb546 100644
--- libvideogfx/graphics/geometry/Makefile.am
+++ libvideogfx/graphics/geometry/Makefile.am
@@ -15,5 +15,5 @@ libvideogfx_graphics_geometry_include_HEADERS = \
 	matrix.hh 	\
 	transform.hh
 
-INCLUDES = \
+AM_CPPFLAGS = \
 	-I$(top_srcdir)
diff --git a/libvideogfx/graphics/measure/Makefile.am b/libvideogfx/graphics/measure/Makefile.am
index c5201ff..21f72c1 100644
--- libvideogfx/graphics/measure/Makefile.am
+++ libvideogfx/graphics/measure/Makefile.am
@@ -3,14 +3,14 @@
 noinst_LTLIBRARIES = libvideogfx-graphics-measure.la
 
 libvideogfx_graphics_measure_la_SOURCES = \
-	snr.hh	\
-	snr.cc
+	snr.hh snr.cc \
+        ssim.hh ssim.cc
 
 libvideogfx_graphics_measure_includedir = \
 	$(includedir)/libvideogfx/graphics/measure
 
 libvideogfx_graphics_measure_include_HEADERS = \
-	snr.hh
+	snr.hh ssim.hh
 
-INCLUDES = \
+AM_CPPFLAGS = \
 	-I$(top_srcdir)
diff --git a/libvideogfx/graphics/measure/snr.cc b/libvideogfx/graphics/measure/snr.cc
index 9400734..e7a5aab 100644
--- libvideogfx/graphics/measure/snr.cc
+++ libvideogfx/graphics/measure/snr.cc
@@ -103,4 +103,52 @@ namespace videogfx {
     return psnr;
   }
 
+
+  Bitmap&lt;Pixel&gt; CalcErrorMap(const Bitmap&lt;Pixel&gt;&amp; img1,
+                             const Bitmap&lt;Pixel&gt;&amp; img2,
+                             enum TransferCurve transfer_curve,
+                             bool inverted)
+  {
+    int w = img1.AskWidth();
+    int h = img1.AskHeight();
+
+    const Pixel*const* p1 = img1.AskFrame();
+    const Pixel*const* p2 = img2.AskFrame();
+
+    Bitmap&lt;Pixel&gt; error;
+    error.Create(w,h);
+
+    Pixel*const* p = error.AskFrame();
+
+
+    // --- prepare transfer curve ---
+
+    Pixel transfer[255+1+255];
+    for (int d=-255;d&lt;=255;d++)
+      {
+        switch (transfer_curve)
+          {
+          case TransferCurve_Linear:
+            transfer[d+255] = abs(d);
+            break;
+
+          case TransferCurve_Sqrt:
+            transfer[d+255] = sqrt(abs(d)/255.0)*255;
+            break;
+          }
+
+        if (inverted) transfer[d+255] = 255 - transfer[d+255];
+      }
+
+
+    // --- generate error map ---
+
+    for (int y=0;y&lt;h;y++)
+      for (int x=0;x&lt;w;x++)
+        {
+          p[y][x] = transfer[p1[y][x] - p2[y][x] + 255];
+        }
+
+    return error;
+  }
 }
diff --git a/libvideogfx/graphics/measure/snr.hh b/libvideogfx/graphics/measure/snr.hh
index 20d26f2..6f2ffe2 100644
--- libvideogfx/graphics/measure/snr.hh
+++ libvideogfx/graphics/measure/snr.hh
@@ -53,6 +53,16 @@ namespace videogfx {
 		  int x0= 0,int y0=0,     // rectangle to consider for the calculation
 		  int x1=-1,int y1=-1);
 
+  enum TransferCurve
+    {
+      TransferCurve_Linear,
+      TransferCurve_Sqrt
+    };
+
+  Bitmap&lt;Pixel&gt; CalcErrorMap(const Bitmap&lt;Pixel&gt;&amp; img1,
+                             const Bitmap&lt;Pixel&gt;&amp; img2,
+                             enum TransferCurve transfer=TransferCurve_Linear,
+                             bool inverted=true);
 }
 
 
diff --git a/libvideogfx/graphics/measure/ssim.cc b/libvideogfx/graphics/measure/ssim.cc
new file mode 100644
index 0000000..45c9fcb
--- /dev/null
+++ libvideogfx/graphics/measure/ssim.cc
@@ -0,0 +1,118 @@
+/********************************************************************************
+    LibVideoGfx - video processing library
+    Copyright (C) 2002-2014  Dirk Farin
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ ********************************************************************************/
+
+#include "libvideogfx/graphics/measure/ssim.hh"
+#include "libvideogfx/graphics/filters/linear.hh"
+#include "libvideogfx/containers/array.hh"
+
+#include &lt;math.h&gt;
+#include &lt;algorithm&gt;
+using namespace std;
+
+
+namespace videogfx {
+
+  template &lt;class T&gt; T SQ(T t) { return t*t; }
+
+
+  Bitmap&lt;float&gt; SSIM::calcSSIM(const Bitmap&lt;Pixel&gt;&amp; img_x,
+                               const Bitmap&lt;Pixel&gt;&amp; img_y)
+  {
+    int w = img_x.AskWidth();
+    int h = img_y.AskHeight();
+
+    Array&lt;double&gt; filter;
+    CreateGaussFilter(filter, sigma, 0.01);
+
+    Bitmap&lt;float&gt; mean_x, mean_y;
+    ConvolveHV(mean_x,img_x, filter);
+    ConvolveHV(mean_y,img_y, filter);
+
+    Bitmap&lt;float&gt; meandiff_x, meandiff_y;
+    meandiff_x.Create(w,h);
+    meandiff_y.Create(w,h);
+
+    for (int y=0;y&lt;h;y++)
+      for (int x=0;x&lt;w;x++) {
+        meandiff_x[y][x] = SQ(mean_x[y][x] - img_x[y][x]);
+        meandiff_y[y][x] = SQ(mean_y[y][x] - img_y[y][x]);
+      }
+
+    Bitmap&lt;float&gt; sigma_x, sigma_y;
+    ConvolveHV(sigma_x,meandiff_x, filter);
+    ConvolveHV(sigma_y,meandiff_y, filter);
+
+    for (int y=0;y&lt;h;y++)
+      for (int x=0;x&lt;w;x++) {
+        sigma_x[y][x] = sqrt(sigma_x[y][x]);
+        sigma_y[y][x] = sqrt(sigma_y[y][x]);
+      }
+
+    Bitmap&lt;float&gt; corr_tmp;
+    corr_tmp.Create(w,h);
+    for (int y=0;y&lt;h;y++)
+      for (int x=0;x&lt;w;x++) {
+        corr_tmp[y][x] = (img_x[y][x]-mean_x[y][x]) * (img_y[y][x]-mean_y[y][x]);
+      }
+
+    Bitmap&lt;float&gt; corr;
+    ConvolveHV(corr, corr_tmp, filter);
+
+    //return corr;
+
+    Bitmap&lt;float&gt; ssim;
+    ssim.Create(w,h);
+    for (int y=0;y&lt;h;y++)
+      for (int x=0;x&lt;w;x++) {
+        float s = (2*mean_x[y][x]*mean_y[y][x] + C1) * (2*corr[y][x] + C2) /
+          ( (mean_x [y][x]*mean_x [y][x] + mean_y [y][x]*mean_y [y][x] + C1 ) *
+            (sigma_x[y][x]*sigma_x[y][x] + sigma_y[y][x]*sigma_y[y][x] + C2) );
+
+        if (s&lt;0.0) s = 0.0;
+        if (s&gt;1.0) s = 1.0;
+
+        ssim[y][x] = s;
+      }
+
+    return ssim;
+  }
+
+
+
+  float SSIM::calcMSSIM(const Bitmap&lt;Pixel&gt;&amp; img1,
+                        const Bitmap&lt;Pixel&gt;&amp; img2)
+  {
+    int w = img1.AskWidth();
+    int h = img1.AskHeight();
+
+    Bitmap&lt;float&gt; ssim = calcSSIM(img1,img2);
+
+    double ssimSum = 0.0;
+
+    for (int y=0;y&lt;h;y++)
+      for (int x=0;x&lt;w;x++)
+        {
+          ssimSum += ssim[y][x];
+        }
+
+    ssimSum /= w*h;
+
+    return ssimSum;
+  }
+}
diff --git a/libvideogfx/graphics/measure/ssim.hh b/libvideogfx/graphics/measure/ssim.hh
new file mode 100644
index 0000000..04188b8
--- /dev/null
+++ libvideogfx/graphics/measure/ssim.hh
@@ -0,0 +1,64 @@
+/*********************************************************************
+  libvideogfx/graphics/measure/ssim.hh
+
+  purpose:
+
+  notes:
+
+  to do:
+
+  author(s):
+   - Dirk Farin, dirk.farin@gmail.com
+
+  modifications:
+    21/Jul/2014 - Dirk Farin - first implementation
+ ********************************************************************************
+    LibVideoGfx - video processing library
+    Copyright (C) 2002-2014 Dirk Farin
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ ********************************************************************************/
+
+#ifndef LIBVIDEOGFX_GRAPHICS_MEASURE_SSIM_HH
+#define LIBVIDEOGFX_GRAPHICS_MEASURE_SSIM_HH
+
+#include &lt;libvideogfx/graphics/datatypes/image.hh&gt;
+
+namespace videogfx {
+
+  class SSIM
+  {
+  public:
+    SSIM() :
+      C1(0.01 * 256),
+      C2(0.03 * 256),
+      r (5), // 11x11 patches
+      sigma(1.5)
+    { }
+
+    float C1, C2;
+    int   r;
+    float sigma;
+
+    Bitmap&lt;float&gt; calcSSIM(const Bitmap&lt;Pixel&gt;&amp; img1,
+                           const Bitmap&lt;Pixel&gt;&amp; img2);
+
+    float calcMSSIM(const Bitmap&lt;Pixel&gt;&amp; img1,
+                    const Bitmap&lt;Pixel&gt;&amp; img2);
+  };
+}
+
+
+#endif
diff --git a/libvideogfx/graphics/visualize/Makefile.am b/libvideogfx/graphics/visualize/Makefile.am
index 02a02f0..0ed5bfc 100644
--- libvideogfx/graphics/visualize/Makefile.am
+++ libvideogfx/graphics/visualize/Makefile.am
@@ -20,5 +20,5 @@ libvideogfx_graphics_visualize_include_HEADERS = \
 #	markblks.hh	\
 #	motionfield.hh
 
-INCLUDES = \
+AM_CPPFLAGS = \
 	-I$(top_srcdir)
diff --git a/libvideogfx/libvideogfx.hh.in b/libvideogfx/libvideogfx.hh.in
index 704553b..bf698ed 100644
--- libvideogfx/libvideogfx.hh.in
+++ libvideogfx/libvideogfx.hh.in
@@ -63,6 +63,7 @@
 #include &lt;libvideogfx/graphics/filters/binomial.hh&gt;
 #include &lt;libvideogfx/graphics/filters/scale.hh&gt;
 #include &lt;libvideogfx/graphics/measure/snr.hh&gt;
+#include &lt;libvideogfx/graphics/measure/ssim.hh&gt;
 #include &lt;libvideogfx/graphics/visualize/regions.hh&gt;
 #include &lt;libvideogfx/audio/fileio/audiosink.hh&gt;
 #include &lt;libvideogfx/audio/fileio/timedsink.hh&gt;
diff --git a/libvideogfx/utility/Makefile.am b/libvideogfx/utility/Makefile.am
index 7150ec6..4da98ba 100644
--- libvideogfx/utility/Makefile.am
+++ libvideogfx/utility/Makefile.am
@@ -21,5 +21,5 @@ libvideogfx_utility_include_HEADERS = \
 	refcntr.hh	
 #	smartpointer.hh
 
-INCLUDES = \
+AM_CPPFLAGS = \
 	-I$(top_srcdir)
diff --git a/libvideogfx/utility/bitstream/Makefile.am b/libvideogfx/utility/bitstream/Makefile.am
index f6cb79d..5f45d84 100644
--- libvideogfx/utility/bitstream/Makefile.am
+++ libvideogfx/utility/bitstream/Makefile.am
@@ -27,5 +27,5 @@ libvideogfx_utility_bitstream_include_HEADERS = \
 	inputstream.hh	\
 	inputstream_istr.hh
 
-INCLUDES = \
+AM_CPPFLAGS = \
 	-I$(top_srcdir)
diff --git a/libvideogfx/utility/bitstream/bitbuffer.cc b/libvideogfx/utility/bitstream/bitbuffer.cc
index 9f879ac..3b469fd 100644
--- libvideogfx/utility/bitstream/bitbuffer.cc
+++ libvideogfx/utility/bitstream/bitbuffer.cc
@@ -58,7 +58,7 @@ namespace videogfx {
 
   void BitBuffer::WriteBitsMasked(uint32 bits,int nBits)
   {
-    uint32 long mask=1;
+    uint32 mask=1;
     mask&lt;&lt;=nBits;
     mask--;
 
diff --git a/libvideogfx/x11/Makefile.am b/libvideogfx/x11/Makefile.am
index 06f8309..2eb6c0e 100644
--- libvideogfx/x11/Makefile.am
+++ libvideogfx/x11/Makefile.am
@@ -22,5 +22,5 @@ libvideogfx_x11_include_HEADERS = \
 	draw_x11.hh	\
 	server.hh
 
-INCLUDES = \
+AM_CPPFLAGS = \
 	-I$(top_srcdir)
</pre></body></html>