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 @@
typedef int ATMO_BOOL;
# define ATMO_TRUE 1
# 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
......@@ -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...
#define ATMO_NUM_CHANNELS 5
......
......@@ -219,7 +219,11 @@ void CAtmoExternalCaptureInput::CalcColors() {
// HSVI = HSV Image allready in right format just copy the easiest task
// 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));
}
......
......@@ -13,6 +13,7 @@
#include "AtmoOutputFilter.h"
CAtmoOutputFilter::CAtmoOutputFilter(CAtmoConfig *atmoConfig)
{
this->m_pAtmoConfig = atmoConfig;
......@@ -93,6 +94,7 @@ void CAtmoOutputFilter::MeanFilter(ATMO_BOOL init)
static tColorPacket filter_output_old;
static int filter_length_old;
char reinitialize = 0;
long int tmp;
if (init) // Initialization
{
......@@ -120,15 +122,21 @@ void CAtmoOutputFilter::MeanFilter(ATMO_BOOL init)
// 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
......
......@@ -261,9 +261,14 @@ void CAtmoTools::SaveBitmap(HDC hdc,HBITMAP hBmp,char *fileName) {
bmpFileHeader.bfReserved1=0;
bmpFileHeader.bfReserved2=0;
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);
FILE *fp = NULL;
fp = fopen(fileName,"wb");
fwrite(&bmpFileHeader,sizeof(BITMAPFILEHEADER),1,fp);
......
......@@ -103,8 +103,11 @@ int CAtmoZoneDefinition::LoadGradientFromBitmap(char *pszBitmap)
fclose(bmp);
return ATMO_LOAD_GRADIENT_FAILED_SIZE;
}
if(bmpFileHeader.bfType != 'MB')
#ifdef _ATMO_VLC_PLUGIN_
if(bmpFileHeader.bfType != VLC_TWOCC('M','B'))
#else
if(bmpFileHeader.bfType != MakeWord('M','B'))
#endif
{
fclose(bmp);
return ATMO_LOAD_GRADIENT_FAILED_HEADER;
......
......@@ -1612,7 +1612,7 @@ void SaveBitmap(filter_sys_t *p_sys, uint8_t *p_pixels, char *psz_filename)
bmp_fileheader.bfSize = sizeof(BITMAPFILEHEADER) +
sizeof(BITMAPINFOHEADER) +
bmp_info.bmiHeader.biSizeImage;
bmp_fileheader.bfType = 'MB';
bmp_fileheader.bfType = VLC_TWOCC('M','B');
bmp_fileheader.bfOffBits = sizeof(BITMAPFILEHEADER) +
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