Index: atmo.cpp
===================================================================
--- atmo.cpp	(Revision 25145)
+++ atmo.cpp	(Arbeitskopie)
@@ -1612,7 +1612,7 @@
     bmp_fileheader.bfSize = sizeof(BITMAPFILEHEADER) +
                             sizeof(BITMAPINFOHEADER) +
                             bmp_info.bmiHeader.biSizeImage;
-    bmp_fileheader.bfType = 'MB';
+    bmp_fileheader.bfType = MakeWord('M','B');
     bmp_fileheader.bfOffBits = sizeof(BITMAPFILEHEADER) +
                                sizeof(BITMAPINFOHEADER);
 
Index: AtmoZoneDefinition.cpp
===================================================================
--- AtmoZoneDefinition.cpp	(Revision 25145)
+++ AtmoZoneDefinition.cpp	(Arbeitskopie)
@@ -104,7 +104,7 @@
         return ATMO_LOAD_GRADIENT_FAILED_SIZE;
     }
 
-    if(bmpFileHeader.bfType != 'MB')
+    if(bmpFileHeader.bfType != MakeWord('M','B'))
     {
         fclose(bmp);
         return ATMO_LOAD_GRADIENT_FAILED_HEADER;
@@ -206,7 +206,7 @@
           {
              destWeight[index] = 0;
           } else {
-             destWeight[index] = (int)(255.0 * (float)pow( ((float)m_BasicWeight[index])/255.0 , newEdgeWeightning));
+   		     destWeight[index] = (int)(255.0 * (float)pow( ((float)m_BasicWeight[index])/255.0 , newEdgeWeightning));
           }
           index++;
       }
Index: AtmoExternalCaptureInput.cpp
===================================================================
--- AtmoExternalCaptureInput.cpp	(Revision 25145)
+++ AtmoExternalCaptureInput.cpp	(Arbeitskopie)
@@ -219,7 +219,7 @@
 
           // HSVI = HSV Image allready in right format just copy the easiest task
           // und weiterverarbeiten lassen
-          if(m_CurrentFrameHeader.biCompression ==  FCC('HSVI'))
+          if(m_CurrentFrameHeader.biCompression ==  MakeDword('H','S','V','I'))
           {
               memcpy( &HSV_Img, m_pCurrentFramePixels, CAP_WIDTH * CAP_HEIGHT * sizeof(tHSVColor));
           }
Index: AtmoDefs.h
===================================================================
--- AtmoDefs.h	(Revision 25145)
+++ AtmoDefs.h	(Arbeitskopie)
@@ -56,11 +56,18 @@
 
 
 
-#define FCC(ch4) ((((DWORD)(ch4) & 0xFF) << 24) |     \
-                  (((DWORD)(ch4) & 0xFF00) << 8) |    \
-                  (((DWORD)(ch4) & 0xFF0000) >> 8) |  \
-                  (((DWORD)(ch4) & 0xFF000000) >> 24))
 
+
+#define MakeWord(ch1,ch2)  ((((int)(ch1)&255)<<8) | \
+                           ((int)(ch2)&255))
+
+#define MakeDword(ch1,ch2,ch3,ch4) ((((DWORD)(ch1)&255) << 24) | \
+                                   (((DWORD)(ch2)&255) << 16) | \
+                                   (((DWORD)(ch3)&255) << 8) | \
+                                   (((DWORD)(ch4)&255)))
+
+
+
 // maximal Anzahl Kanäle...
 #define ATMO_NUM_CHANNELS   5
 
Index: AtmoInput.cpp
===================================================================
--- AtmoInput.cpp	(Revision 25145)
+++ AtmoInput.cpp	(Arbeitskopie)
@@ -24,3 +24,4 @@
     return;
 }
 
+
Index: AtmoTools.cpp
===================================================================
--- AtmoTools.cpp	(Revision 25145)
+++ AtmoTools.cpp	(Arbeitskopie)
@@ -261,7 +261,7 @@
      bmpFileHeader.bfReserved1=0;
      bmpFileHeader.bfReserved2=0;
      bmpFileHeader.bfSize=sizeof(BITMAPFILEHEADER)+sizeof(BITMAPINFOHEADER)+bmpInfo.bmiHeader.biSizeImage;
-     bmpFileHeader.bfType='MB';
+     bmpFileHeader.bfType = MakeWord('M','B');
      bmpFileHeader.bfOffBits=sizeof(BITMAPFILEHEADER)+sizeof(BITMAPINFOHEADER);
 
      FILE *fp = NULL;
Index: AtmoOutputFilter.cpp
===================================================================
--- AtmoOutputFilter.cpp	(Revision 25145)
+++ AtmoOutputFilter.cpp	(Arbeitskopie)
@@ -13,6 +13,7 @@
 #include "AtmoOutputFilter.h"
 
 
+
 CAtmoOutputFilter::CAtmoOutputFilter(CAtmoConfig *atmoConfig)
 {
    this->m_pAtmoConfig = atmoConfig;
@@ -93,6 +94,7 @@
   static tColorPacket filter_output_old;
   static int filter_length_old;
   char reinitialize = 0;
+  long int tmp;
 
   if (init) // Initialization
   {
@@ -120,15 +122,21 @@
     // calculate the mean-value filters
     mean_sums.channel[ch].r +=
          (long int)(filter_input.channel[ch].r - mean_values.channel[ch].r); // red
-    mean_values.channel[ch].r = mean_sums.channel[ch].r / ((long int)filter_length_old / 20);
+    tmp = mean_sums.channel[ch].r / ((long int)filter_length_old / 20);
+    if(tmp<0) tmp = 0; else { if(tmp>255) tmp = 255; }
+    mean_values.channel[ch].r = (unsigned char)tmp;
 
     mean_sums.channel[ch].g +=
         (long int)(filter_input.channel[ch].g - mean_values.channel[ch].g); // green
-    mean_values.channel[ch].g = mean_sums.channel[ch].g / ((long int)filter_length_old / 20);
+    tmp = mean_sums.channel[ch].g / ((long int)filter_length_old / 20);
+    if(tmp<0) tmp = 0; else { if(tmp>255) tmp = 255; }
+    mean_values.channel[ch].g = (unsigned char)tmp;
 
     mean_sums.channel[ch].b +=
         (long int)(filter_input.channel[ch].b - mean_values.channel[ch].b); // blue
-    mean_values.channel[ch].b = mean_sums.channel[ch].b / ((long int)filter_length_old / 20);
+    tmp = mean_sums.channel[ch].b / ((long int)filter_length_old / 20);
+    if(tmp<0) tmp = 0; else { if(tmp>255) tmp = 255; }
+    mean_values.channel[ch].b = (unsigned char)tmp;
 
     // check, if there is a jump -> check if differences between actual values and filter values are too big
 
