Commit bb05ac4f authored by Jean-Paul Saman's avatar Jean-Paul Saman

Patch by Andre Weber: fix several warnings in atmo video_filter.

parent f8743ad0
...@@ -25,6 +25,14 @@ ...@@ -25,6 +25,14 @@
typedef int ATMO_BOOL; typedef int ATMO_BOOL;
# define ATMO_TRUE 1 # define ATMO_TRUE 1
# define ATMO_FALSE 0 # define ATMO_FALSE 0
# 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)))
#endif #endif
...@@ -56,10 +64,9 @@ typedef struct ...@@ -56,10 +64,9 @@ typedef struct
#define FCC(ch4) ((((DWORD)(ch4) & 0xFF) << 24) | \
(((DWORD)(ch4) & 0xFF00) << 8) | \
(((DWORD)(ch4) & 0xFF0000) >> 8) | \
(((DWORD)(ch4) & 0xFF000000) >> 24))
// maximal Anzahl Kanle... // maximal Anzahl Kanle...
#define ATMO_NUM_CHANNELS 5 #define ATMO_NUM_CHANNELS 5
......
...@@ -219,7 +219,11 @@ void CAtmoExternalCaptureInput::CalcColors() { ...@@ -219,7 +219,11 @@ void CAtmoExternalCaptureInput::CalcColors() {
// HSVI = HSV Image allready in right format just copy the easiest task // HSVI = HSV Image allready in right format just copy the easiest task
// und weiterverarbeiten lassen // und weiterverarbeiten lassen
if(m_CurrentFrameHeader.biCompression == FCC('HSVI')) #ifdef _ATMO_VLC_PLUGIN_
if(m_CurrentFrameHeader.biCompression == VLC_FOURCC('H','S','V','I'))
#else
if(m_CurrentFrameHeader.biCompression == MakeDword('H','S','V','I'))
#endif
{ {
memcpy( &HSV_Img, m_pCurrentFramePixels, CAP_WIDTH * CAP_HEIGHT * sizeof(tHSVColor)); memcpy( &HSV_Img, m_pCurrentFramePixels, CAP_WIDTH * CAP_HEIGHT * sizeof(tHSVColor));
} }
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include "AtmoOutputFilter.h" #include "AtmoOutputFilter.h"
CAtmoOutputFilter::CAtmoOutputFilter(CAtmoConfig *atmoConfig) CAtmoOutputFilter::CAtmoOutputFilter(CAtmoConfig *atmoConfig)
{ {
this->m_pAtmoConfig = atmoConfig; this->m_pAtmoConfig = atmoConfig;
...@@ -93,6 +94,7 @@ void CAtmoOutputFilter::MeanFilter(ATMO_BOOL init) ...@@ -93,6 +94,7 @@ void CAtmoOutputFilter::MeanFilter(ATMO_BOOL init)
static tColorPacket filter_output_old; static tColorPacket filter_output_old;
static int filter_length_old; static int filter_length_old;
char reinitialize = 0; char reinitialize = 0;
long int tmp;
if (init) // Initialization if (init) // Initialization
{ {
...@@ -120,15 +122,21 @@ void CAtmoOutputFilter::MeanFilter(ATMO_BOOL init) ...@@ -120,15 +122,21 @@ void CAtmoOutputFilter::MeanFilter(ATMO_BOOL init)
// calculate the mean-value filters // calculate the mean-value filters
mean_sums.channel[ch].r += mean_sums.channel[ch].r +=
(long int)(filter_input.channel[ch].r - mean_values.channel[ch].r); // red (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 += mean_sums.channel[ch].g +=
(long int)(filter_input.channel[ch].g - mean_values.channel[ch].g); // green (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 += mean_sums.channel[ch].b +=
(long int)(filter_input.channel[ch].b - mean_values.channel[ch].b); // blue (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 // check, if there is a jump -> check if differences between actual values and filter values are too big
......
...@@ -261,9 +261,14 @@ void CAtmoTools::SaveBitmap(HDC hdc,HBITMAP hBmp,char *fileName) { ...@@ -261,9 +261,14 @@ void CAtmoTools::SaveBitmap(HDC hdc,HBITMAP hBmp,char *fileName) {
bmpFileHeader.bfReserved1=0; bmpFileHeader.bfReserved1=0;
bmpFileHeader.bfReserved2=0; bmpFileHeader.bfReserved2=0;
bmpFileHeader.bfSize=sizeof(BITMAPFILEHEADER)+sizeof(BITMAPINFOHEADER)+bmpInfo.bmiHeader.biSizeImage; bmpFileHeader.bfSize=sizeof(BITMAPFILEHEADER)+sizeof(BITMAPINFOHEADER)+bmpInfo.bmiHeader.biSizeImage;
bmpFileHeader.bfType='MB'; #ifdef _ATMO_VLC_PLUGIN_
bmpFileHeader.bfType = VLC_TWOCC('M','B');
#else
bmpFileHeader.bfType = MakeWord('M','B');
#endif
bmpFileHeader.bfOffBits=sizeof(BITMAPFILEHEADER)+sizeof(BITMAPINFOHEADER); bmpFileHeader.bfOffBits=sizeof(BITMAPFILEHEADER)+sizeof(BITMAPINFOHEADER);
FILE *fp = NULL; FILE *fp = NULL;
fp = fopen(fileName,"wb"); fp = fopen(fileName,"wb");
fwrite(&bmpFileHeader,sizeof(BITMAPFILEHEADER),1,fp); fwrite(&bmpFileHeader,sizeof(BITMAPFILEHEADER),1,fp);
......
...@@ -103,8 +103,11 @@ int CAtmoZoneDefinition::LoadGradientFromBitmap(char *pszBitmap) ...@@ -103,8 +103,11 @@ int CAtmoZoneDefinition::LoadGradientFromBitmap(char *pszBitmap)
fclose(bmp); fclose(bmp);
return ATMO_LOAD_GRADIENT_FAILED_SIZE; return ATMO_LOAD_GRADIENT_FAILED_SIZE;
} }
#ifdef _ATMO_VLC_PLUGIN_
if(bmpFileHeader.bfType != 'MB') if(bmpFileHeader.bfType != VLC_TWOCC('M','B'))
#else
if(bmpFileHeader.bfType != MakeWord('M','B'))
#endif
{ {
fclose(bmp); fclose(bmp);
return ATMO_LOAD_GRADIENT_FAILED_HEADER; return ATMO_LOAD_GRADIENT_FAILED_HEADER;
...@@ -206,7 +209,7 @@ void CAtmoZoneDefinition::UpdateWeighting(int *destWeight, ...@@ -206,7 +209,7 @@ void CAtmoZoneDefinition::UpdateWeighting(int *destWeight,
{ {
destWeight[index] = 0; destWeight[index] = 0;
} else { } 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++;
} }
......
...@@ -1612,7 +1612,7 @@ void SaveBitmap(filter_sys_t *p_sys, uint8_t *p_pixels, char *psz_filename) ...@@ -1612,7 +1612,7 @@ void SaveBitmap(filter_sys_t *p_sys, uint8_t *p_pixels, char *psz_filename)
bmp_fileheader.bfSize = sizeof(BITMAPFILEHEADER) + bmp_fileheader.bfSize = sizeof(BITMAPFILEHEADER) +
sizeof(BITMAPINFOHEADER) + sizeof(BITMAPINFOHEADER) +
bmp_info.bmiHeader.biSizeImage; bmp_info.bmiHeader.biSizeImage;
bmp_fileheader.bfType = 'MB'; bmp_fileheader.bfType = VLC_TWOCC('M','B');
bmp_fileheader.bfOffBits = sizeof(BITMAPFILEHEADER) + bmp_fileheader.bfOffBits = sizeof(BITMAPFILEHEADER) +
sizeof(BITMAPINFOHEADER); sizeof(BITMAPINFOHEADER);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment