First work on adding built-in deinterlacing to ZM.

pull/49/head
Kfir Itzhak 2012-01-25 16:59:56 +02:00
parent e413042cdb
commit 8f0ec42ba2
5 changed files with 174 additions and 10 deletions

View File

@ -2663,6 +2663,145 @@ void Image::Scale( unsigned int factor )
} }
void Image::Deinterlace_Discard()
{
/* Simple deinterlacing. Copy the even lines into the odd lines */
if ( colours == ZM_COLOUR_GRAY8 )
{
const uint8_t *psrc;
uint8_t *pdest;
for (unsigned int y = 0; y < height; y += 2)
{
psrc = buffer + (y * width);
pdest = buffer + ((y+1) * width);
for (unsigned int x = 0; x < width; x++) {
*pdest++ = *psrc++;
}
}
}
else if ( colours == ZM_COLOUR_RGB24 )
{
const uint8_t *psrc;
uint8_t *pdest;
for (unsigned int y = 0; y < height; y += 2)
{
psrc = buffer + ((y * width) * 3);
pdest = buffer + (((y+1) * width) * 3);
for (unsigned int x = 0; x < width; x++) {
*pdest++ = *psrc++;
*pdest++ = *psrc++;
*pdest++ = *psrc++;
}
}
}
else if ( colours == ZM_COLOUR_RGB32 )
{
const Rgb *psrc;
Rgb *pdest;
for (unsigned int y = 0; y < height; y += 2)
{
psrc = (Rgb*)(buffer + ((y * width) << 2));
pdest = (Rgb*)(buffer + (((y+1) * width) << 2));
for (unsigned int x = 0; x < width; x++) {
*pdest++ = *psrc++;
}
}
} else {
Error("Deinterlace called with unexpected colours: %d", colours);
}
}
void Image::Deinterlace_Linear()
{
/* Simple deinterlacing. The odd lines are average of the line above and line below */
if ( colours == ZM_COLOUR_GRAY8 )
{
const uint8_t *pbelow, *pabove;
uint8_t *pcurrent;
for (unsigned int y = 1; y < (height-1); y += 2)
{
pabove = buffer + ((y-1) * width);
pbelow = buffer + ((y+1) * width);
pcurrent = buffer + (y * width);
for (unsigned int x = 0; x < width; x++) {
*pcurrent++ = (*pabove++ + *pbelow++) >> 1;
}
}
/* Special case for the last line */
pcurrent = buffer + ((height-1) * width);
pabove = buffer + ((height-2) * width);
for (unsigned int x = 0; x < width; x++) {
*pcurrent++ = *pabove++;
}
}
else if ( colours == ZM_COLOUR_RGB24 )
{
const uint8_t *pbelow, *pabove;
uint8_t *pcurrent;
for (unsigned int y = 1; y < (height-1); y += 2)
{
pabove = buffer + (((y-1) * width) * 3);
pbelow = buffer + (((y+1) * width) * 3);
pcurrent = buffer + ((y * width) * 3);
for (unsigned int x = 0; x < width; x++) {
*pcurrent++ = (*pabove++ + *pbelow++) >> 1;
*pcurrent++ = (*pabove++ + *pbelow++) >> 1;
*pcurrent++ = (*pabove++ + *pbelow++) >> 1;
}
}
/* Special case for the last line */
pcurrent = buffer + (((height-1) * width) * 3);
pabove = buffer + (((height-2) * width) * 3);
for (unsigned int x = 0; x < width; x++) {
*pcurrent++ = *pabove++;
*pcurrent++ = *pabove++;
*pcurrent++ = *pabove++;
}
}
else if ( colours == ZM_COLOUR_RGB32 )
{
const Rgb *pbelow, *pabove;
Rgb *pcurrent;
for (unsigned int y = 1; y < (height-1); y += 2)
{
pabove = (Rgb*)(buffer + (((y-1) * width) << 2));
pbelow = (Rgb*)(buffer + (((y+1) * width) << 2));
pcurrent = (Rgb*)(buffer + ((y * width) << 2));
for (unsigned int x = 0; x < width; x++) {
*pcurrent++ = (*pabove++ + *pbelow++) >> 1;
}
}
/* Special case for the last line */
pcurrent = (Rgb*)(buffer + (((height-1) * width) << 2));
pabove = (Rgb*)(buffer + (((height-2) * width) << 2));
for (unsigned int x = 0; x < width; x++) {
*pcurrent++ = *pabove++;
}
} else {
Error("Deinterlace called with unexpected colours: %d", colours);
}
}
/*
void Image::Deinterlace_4field_linear_weave(const image* next_image, image* dest_image)
{
if ( !(width == next_image.width && height == next_image.height && colours == next_image.colours && subpixelorder == next_image.subpixelorder) )
{
Panic( "Attempt to deinterlace different sized images, expected %dx%dx%d %d, got %dx%dx%d %d", width, height, colours, subpixelorder, next_image.width, next_image.height, next_image.colours, next_image.subpixelorder);
}
uint8_t *pdest = dest_image->WriteBuffer(width, height, colours, subpixelorder);
}
*/
/************************************************* BLEND FUNCTIONS *************************************************/ /************************************************* BLEND FUNCTIONS *************************************************/

View File

@ -242,6 +242,9 @@ public:
void Rotate( int angle ); void Rotate( int angle );
void Flip( bool leftright ); void Flip( bool leftright );
void Scale( unsigned int factor ); void Scale( unsigned int factor );
void Deinterlace_Discard();
void Deinterlace_Linear();
}; };
#endif // ZM_IMAGE_H #endif // ZM_IMAGE_H

View File

@ -244,6 +244,7 @@ Monitor::Monitor(
const char *p_linked_monitors, const char *p_linked_monitors,
Camera *p_camera, Camera *p_camera,
int p_orientation, int p_orientation,
unsigned int p_deinterlacing,
const char *p_event_prefix, const char *p_event_prefix,
const char *p_label_format, const char *p_label_format,
const Coord &p_label_coord, const Coord &p_label_coord,
@ -270,6 +271,7 @@ Monitor::Monitor(
width( (p_orientation==ROTATE_90||p_orientation==ROTATE_270)?p_camera->Height():p_camera->Width() ), width( (p_orientation==ROTATE_90||p_orientation==ROTATE_270)?p_camera->Height():p_camera->Width() ),
height( (p_orientation==ROTATE_90||p_orientation==ROTATE_270)?p_camera->Width():p_camera->Height() ), height( (p_orientation==ROTATE_90||p_orientation==ROTATE_270)?p_camera->Width():p_camera->Height() ),
orientation( (Orientation)p_orientation ), orientation( (Orientation)p_orientation ),
deinterlacing( p_deinterlacing ),
label_coord( p_label_coord ), label_coord( p_label_coord ),
image_buffer_count( p_image_buffer_count ), image_buffer_count( p_image_buffer_count ),
warmup_count( p_warmup_count ), warmup_count( p_warmup_count ),
@ -1769,11 +1771,11 @@ int Monitor::LoadLocalMonitors( const char *device, Monitor **&monitors, Purpose
static char sql[ZM_SQL_MED_BUFSIZ]; static char sql[ZM_SQL_MED_BUFSIZ];
if ( !device[0] ) if ( !device[0] )
{ {
strncpy( sql, "select Id, Name, Function+0, Enabled, LinkedMonitors, Device, Channel, Format, Method, Width, Height, Colours, Palette, Orientation+0, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, SectionLength, FrameSkip, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, TrackMotion, SignalCheckColour from Monitors where Function != 'None' and Type = 'Local' order by Device, Channel", sizeof(sql) ); strncpy( sql, "select Id, Name, Function+0, Enabled, LinkedMonitors, Device, Channel, Format, Method, Width, Height, Colours, Palette, Orientation+0, Deinterlacing, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, SectionLength, FrameSkip, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, TrackMotion, SignalCheckColour from Monitors where Function != 'None' and Type = 'Local' order by Device, Channel", sizeof(sql) );
} }
else else
{ {
snprintf( sql, sizeof(sql), "select Id, Name, Function+0, Enabled, LinkedMonitors, Device, Channel, Format, Method, Width, Height, Colours, Palette, Orientation+0, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, SectionLength, FrameSkip, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, TrackMotion, SignalCheckColour from Monitors where Function != 'None' and Type = 'Local' and Device = '%s' order by Channel", device ); snprintf( sql, sizeof(sql), "select Id, Name, Function+0, Enabled, LinkedMonitors, Device, Channel, Format, Method, Width, Height, Colours, Palette, Orientation+0, Deinterlacing, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, SectionLength, FrameSkip, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, TrackMotion, SignalCheckColour from Monitors where Function != 'None' and Type = 'Local' and Device = '%s' order by Channel", device );
} }
if ( mysql_query( &dbconn, sql ) ) if ( mysql_query( &dbconn, sql ) )
{ {
@ -1811,6 +1813,7 @@ int Monitor::LoadLocalMonitors( const char *device, Monitor **&monitors, Purpose
int colours = atoi(dbrow[col]); col++; int colours = atoi(dbrow[col]); col++;
int palette = atoi(dbrow[col]); col++; int palette = atoi(dbrow[col]); col++;
Orientation orientation = (Orientation)atoi(dbrow[col]); col++; Orientation orientation = (Orientation)atoi(dbrow[col]); col++;
unsigned int deinterlacing = atoi(dbrow[col]); col++;
int brightness = atoi(dbrow[col]); col++; int brightness = atoi(dbrow[col]); col++;
int contrast = atoi(dbrow[col]); col++; int contrast = atoi(dbrow[col]); col++;
int hue = atoi(dbrow[col]); col++; int hue = atoi(dbrow[col]); col++;
@ -1870,6 +1873,7 @@ int Monitor::LoadLocalMonitors( const char *device, Monitor **&monitors, Purpose
linked_monitors, linked_monitors,
camera, camera,
orientation, orientation,
deinterlacing,
event_prefix, event_prefix,
label_format, label_format,
Coord( label_x, label_y ), Coord( label_x, label_y ),
@ -1911,11 +1915,11 @@ int Monitor::LoadRemoteMonitors( const char *protocol, const char *host, const c
static char sql[ZM_SQL_MED_BUFSIZ]; static char sql[ZM_SQL_MED_BUFSIZ];
if ( !protocol ) if ( !protocol )
{ {
strncpy( sql, "select Id, Name, Function+0, Enabled, LinkedMonitors, Protocol, Method, Host, Port, Path, Width, Height, Colours, Palette, Orientation+0, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, SectionLength, FrameSkip, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, TrackMotion from Monitors where Function != 'None' and Type = 'Remote'", sizeof(sql) ); strncpy( sql, "select Id, Name, Function+0, Enabled, LinkedMonitors, Protocol, Method, Host, Port, Path, Width, Height, Colours, Palette, Orientation+0, Deinterlacing, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, SectionLength, FrameSkip, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, TrackMotion from Monitors where Function != 'None' and Type = 'Remote'", sizeof(sql) );
} }
else else
{ {
snprintf( sql, sizeof(sql), "select Id, Name, Function+0, Enabled, LinkedMonitors, Protocol, Method, Host, Port, Path, Width, Height, Colours, Palette, Orientation+0, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, SectionLength, FrameSkip, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, TrackMotion from Monitors where Function != 'None' and Type = 'Remote' and Protocol = '%s' and Host = '%s' and Port = '%s' and Path = '%s'", protocol, host, port, path ); snprintf( sql, sizeof(sql), "select Id, Name, Function+0, Enabled, LinkedMonitors, Protocol, Method, Host, Port, Path, Width, Height, Colours, Palette, Orientation+0, Deinterlacing, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, SectionLength, FrameSkip, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, TrackMotion from Monitors where Function != 'None' and Type = 'Remote' and Protocol = '%s' and Host = '%s' and Port = '%s' and Path = '%s'", protocol, host, port, path );
} }
if ( mysql_query( &dbconn, sql ) ) if ( mysql_query( &dbconn, sql ) )
{ {
@ -1954,6 +1958,7 @@ int Monitor::LoadRemoteMonitors( const char *protocol, const char *host, const c
int colours = atoi(dbrow[col]); col++; int colours = atoi(dbrow[col]); col++;
/* int palette = atoi(dbrow[col]); */ col++; /* int palette = atoi(dbrow[col]); */ col++;
Orientation orientation = (Orientation)atoi(dbrow[col]); col++; Orientation orientation = (Orientation)atoi(dbrow[col]); col++;
unsigned int deinterlacing = atoi(dbrow[col]); col++;
int brightness = atoi(dbrow[col]); col++; int brightness = atoi(dbrow[col]); col++;
int contrast = atoi(dbrow[col]); col++; int contrast = atoi(dbrow[col]); col++;
int hue = atoi(dbrow[col]); col++; int hue = atoi(dbrow[col]); col++;
@ -2034,6 +2039,7 @@ int Monitor::LoadRemoteMonitors( const char *protocol, const char *host, const c
linked_monitors, linked_monitors,
camera, camera,
orientation, orientation,
deinterlacing,
event_prefix.c_str(), event_prefix.c_str(),
label_format.c_str(), label_format.c_str(),
Coord( label_x, label_y ), Coord( label_x, label_y ),
@ -2074,11 +2080,11 @@ int Monitor::LoadFileMonitors( const char *file, Monitor **&monitors, Purpose pu
static char sql[ZM_SQL_MED_BUFSIZ]; static char sql[ZM_SQL_MED_BUFSIZ];
if ( !file[0] ) if ( !file[0] )
{ {
strncpy( sql, "select Id, Name, Function+0, Enabled, LinkedMonitors, Path, Width, Height, Colours, Palette, Orientation+0, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, SectionLength, FrameSkip, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, TrackMotion from Monitors where Function != 'None' and Type = 'File'", sizeof(sql) ); strncpy( sql, "select Id, Name, Function+0, Enabled, LinkedMonitors, Path, Width, Height, Colours, Palette, Orientation+0, Deinterlacing, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, SectionLength, FrameSkip, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, TrackMotion from Monitors where Function != 'None' and Type = 'File'", sizeof(sql) );
} }
else else
{ {
snprintf( sql, sizeof(sql), "select Id, Name, Function+0, Enabled, LinkedMonitors, Path, Width, Height, Colours, Palette, Orientation+0, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, SectionLength, FrameSkip, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, TrackMotion from Monitors where Function != 'None' and Type = 'File' and Path = '%s'", file ); snprintf( sql, sizeof(sql), "select Id, Name, Function+0, Enabled, LinkedMonitors, Path, Width, Height, Colours, Palette, Orientation+0, Deinterlacing, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, SectionLength, FrameSkip, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, TrackMotion from Monitors where Function != 'None' and Type = 'File' and Path = '%s'", file );
} }
if ( mysql_query( &dbconn, sql ) ) if ( mysql_query( &dbconn, sql ) )
{ {
@ -2113,6 +2119,7 @@ int Monitor::LoadFileMonitors( const char *file, Monitor **&monitors, Purpose pu
int colours = atoi(dbrow[col]); col++; int colours = atoi(dbrow[col]); col++;
/* int palette = atoi(dbrow[col]); */ col++; /* int palette = atoi(dbrow[col]); */ col++;
Orientation orientation = (Orientation)atoi(dbrow[col]); col++; Orientation orientation = (Orientation)atoi(dbrow[col]); col++;
unsigned int deinterlacing = atoi(dbrow[col]); col++;
int brightness = atoi(dbrow[col]); col++; int brightness = atoi(dbrow[col]); col++;
int contrast = atoi(dbrow[col]); col++; int contrast = atoi(dbrow[col]); col++;
int hue = atoi(dbrow[col]); col++; int hue = atoi(dbrow[col]); col++;
@ -2162,6 +2169,7 @@ int Monitor::LoadFileMonitors( const char *file, Monitor **&monitors, Purpose pu
linked_monitors, linked_monitors,
camera, camera,
orientation, orientation,
deinterlacing,
event_prefix, event_prefix,
label_format, label_format,
Coord( label_x, label_y ), Coord( label_x, label_y ),
@ -2203,11 +2211,11 @@ int Monitor::LoadFfmpegMonitors( const char *file, Monitor **&monitors, Purpose
static char sql[ZM_SQL_MED_BUFSIZ]; static char sql[ZM_SQL_MED_BUFSIZ];
if ( !file[0] ) if ( !file[0] )
{ {
strncpy( sql, "select Id, Name, Function+0, Enabled, LinkedMonitors, Path, Width, Height, Colours, Palette, Orientation+0, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, SectionLength, FrameSkip, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, TrackMotion from Monitors where Function != 'None' and Type = 'Ffmpeg'", sizeof(sql) ); strncpy( sql, "select Id, Name, Function+0, Enabled, LinkedMonitors, Path, Width, Height, Colours, Palette, Orientation+0, Deinterlacing, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, SectionLength, FrameSkip, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, TrackMotion from Monitors where Function != 'None' and Type = 'Ffmpeg'", sizeof(sql) );
} }
else else
{ {
snprintf( sql, sizeof(sql), "select Id, Name, Function+0, Enabled, LinkedMonitors, Path, Width, Height, Colours, Palette, Orientation+0, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, SectionLength, FrameSkip, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, TrackMotion from Monitors where Function != 'None' and Type = 'Ffmpeg' and Path = '%s'", file ); snprintf( sql, sizeof(sql), "select Id, Name, Function+0, Enabled, LinkedMonitors, Path, Width, Height, Colours, Palette, Orientation+0, Deinterlacing, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, SectionLength, FrameSkip, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, TrackMotion from Monitors where Function != 'None' and Type = 'Ffmpeg' and Path = '%s'", file );
} }
if ( mysql_query( &dbconn, sql ) ) if ( mysql_query( &dbconn, sql ) )
{ {
@ -2242,6 +2250,7 @@ int Monitor::LoadFfmpegMonitors( const char *file, Monitor **&monitors, Purpose
int colours = atoi(dbrow[col]); col++; int colours = atoi(dbrow[col]); col++;
/* int palette = atoi(dbrow[col]); */ col++; /* int palette = atoi(dbrow[col]); */ col++;
Orientation orientation = (Orientation)atoi(dbrow[col]); col++; Orientation orientation = (Orientation)atoi(dbrow[col]); col++;
unsigned int deinterlacing = atoi(dbrow[col]); col++;
int brightness = atoi(dbrow[col]); col++; int brightness = atoi(dbrow[col]); col++;
int contrast = atoi(dbrow[col]); col++; int contrast = atoi(dbrow[col]); col++;
int hue = atoi(dbrow[col]); col++; int hue = atoi(dbrow[col]); col++;
@ -2291,6 +2300,7 @@ int Monitor::LoadFfmpegMonitors( const char *file, Monitor **&monitors, Purpose
linked_monitors, linked_monitors,
camera, camera,
orientation, orientation,
deinterlacing,
event_prefix, event_prefix,
label_format, label_format,
Coord( label_x, label_y ), Coord( label_x, label_y ),
@ -2330,7 +2340,7 @@ int Monitor::LoadFfmpegMonitors( const char *file, Monitor **&monitors, Purpose
Monitor *Monitor::Load( int id, bool load_zones, Purpose purpose ) Monitor *Monitor::Load( int id, bool load_zones, Purpose purpose )
{ {
static char sql[ZM_SQL_MED_BUFSIZ]; static char sql[ZM_SQL_MED_BUFSIZ];
snprintf( sql, sizeof(sql), "select Id, Name, Type, Function+0, Enabled, LinkedMonitors, Device, Channel, Format, Protocol, Method, Host, Port, Path, Width, Height, Colours, Palette, Orientation+0, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, SectionLength, FrameSkip, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, TrackMotion, SignalCheckColour from Monitors where Id = %d", id ); snprintf( sql, sizeof(sql), "select Id, Name, Type, Function+0, Enabled, LinkedMonitors, Device, Channel, Format, Protocol, Method, Host, Port, Path, Width, Height, Colours, Palette, Orientation+0, Deinterlacing, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, SectionLength, FrameSkip, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, TrackMotion, SignalCheckColour from Monitors where Id = %d", id );
if ( mysql_query( &dbconn, sql ) ) if ( mysql_query( &dbconn, sql ) )
{ {
Error( "Can't run query: %s", mysql_error( &dbconn ) ); Error( "Can't run query: %s", mysql_error( &dbconn ) );
@ -2372,6 +2382,7 @@ Monitor *Monitor::Load( int id, bool load_zones, Purpose purpose )
int colours = atoi(dbrow[col]); col++; int colours = atoi(dbrow[col]); col++;
int palette = atoi(dbrow[col]); col++; int palette = atoi(dbrow[col]); col++;
Orientation orientation = (Orientation)atoi(dbrow[col]); col++; Orientation orientation = (Orientation)atoi(dbrow[col]); col++;
unsigned int deinterlacing = atoi(dbrow[col]); col++;
int brightness = atoi(dbrow[col]); col++; int brightness = atoi(dbrow[col]); col++;
int contrast = atoi(dbrow[col]); col++; int contrast = atoi(dbrow[col]); col++;
int hue = atoi(dbrow[col]); col++; int hue = atoi(dbrow[col]); col++;
@ -2522,6 +2533,7 @@ Monitor *Monitor::Load( int id, bool load_zones, Purpose purpose )
linked_monitors.c_str(), linked_monitors.c_str(),
camera, camera,
orientation, orientation,
deinterlacing,
event_prefix.c_str(), event_prefix.c_str(),
label_format.c_str(), label_format.c_str(),
Coord( label_x, label_y ), Coord( label_x, label_y ),

View File

@ -210,6 +210,7 @@ protected:
unsigned int width; // Normally the same as the camera, but not if partly rotated unsigned int width; // Normally the same as the camera, but not if partly rotated
unsigned int height; // Normally the same as the camera, but not if partly rotated unsigned int height; // Normally the same as the camera, but not if partly rotated
Orientation orientation; // Whether the image has to be rotated at all Orientation orientation; // Whether the image has to be rotated at all
unsigned int deinterlacing;
int brightness; // The statically saved brightness of the camera int brightness; // The statically saved brightness of the camera
int contrast; // The statically saved contrast of the camera int contrast; // The statically saved contrast of the camera
int hue; // The statically saved hue of the camera int hue; // The statically saved hue of the camera
@ -276,7 +277,7 @@ protected:
MonitorLink **linked_monitors; MonitorLink **linked_monitors;
public: public:
Monitor( int p_id, const char *p_name, int p_function, bool p_enabled, const char *p_linked_monitors, Camera *p_camera, int p_orientation, const char *p_event_prefix, const char *p_label_format, const Coord &p_label_coord, int p_image_buffer_count, int p_warmup_count, int p_pre_event_count, int p_post_event_count, int p_stream_replay_buffer, int p_alarm_frame_count, int p_section_length, int p_frame_skip, int p_capture_delay, int p_alarm_capture_delay, int p_fps_report_interval, int p_ref_blend_perc, bool p_track_motion, Rgb p_signal_check_colour, Purpose p_purpose, int p_n_zones=0, Zone *p_zones[]=0 ); Monitor( int p_id, const char *p_name, int p_function, bool p_enabled, const char *p_linked_monitors, Camera *p_camera, int p_orientation, unsigned int p_deinterlacing, const char *p_event_prefix, const char *p_label_format, const Coord &p_label_coord, int p_image_buffer_count, int p_warmup_count, int p_pre_event_count, int p_post_event_count, int p_stream_replay_buffer, int p_alarm_frame_count, int p_section_length, int p_frame_skip, int p_capture_delay, int p_alarm_capture_delay, int p_fps_report_interval, int p_ref_blend_perc, bool p_track_motion, Rgb p_signal_check_colour, Purpose p_purpose, int p_n_zones=0, Zone *p_zones[]=0 );
~Monitor(); ~Monitor();
void AddZones( int p_n_zones, Zone *p_zones[] ); void AddZones( int p_n_zones, Zone *p_zones[] );

View File

@ -69,6 +69,7 @@ else
'Width' => "320", 'Width' => "320",
'Height' => "240", 'Height' => "240",
'Orientation' => "0", 'Orientation' => "0",
'Deinterlacing' => 0,
'LabelFormat' => '%N - %d/%m/%y %H:%M:%S', 'LabelFormat' => '%N - %d/%m/%y %H:%M:%S',
'LabelX' => 0, 'LabelX' => 0,
'LabelY' => 0, 'LabelY' => 0,
@ -361,6 +362,12 @@ $orientations = array(
$SLANG['FlippedVert'] => 'vert' $SLANG['FlippedVert'] => 'vert'
); );
$deinterlaceopts = array(
"Disabled" => 0,
"Discard" => 1,
"Linear" => 2
);
xhtmlHeaders(__FILE__, $SLANG['Monitor']." - ".validHtmlStr($monitor['Name']) ); xhtmlHeaders(__FILE__, $SLANG['Monitor']." - ".validHtmlStr($monitor['Name']) );
?> ?>
<body> <body>
@ -465,6 +472,7 @@ if ( $tab != 'source' )
<input type="hidden" name="newMonitor[Width]" value="<?= validHtmlStr($newMonitor['Width']) ?>"/> <input type="hidden" name="newMonitor[Width]" value="<?= validHtmlStr($newMonitor['Width']) ?>"/>
<input type="hidden" name="newMonitor[Height]" value="<?= validHtmlStr($newMonitor['Height']) ?>"/> <input type="hidden" name="newMonitor[Height]" value="<?= validHtmlStr($newMonitor['Height']) ?>"/>
<input type="hidden" name="newMonitor[Orientation]" value="<?= validHtmlStr($newMonitor['Orientation']) ?>"/> <input type="hidden" name="newMonitor[Orientation]" value="<?= validHtmlStr($newMonitor['Orientation']) ?>"/>
<input type="hidden" name="newMonitor[Deinterlacing]" value="<?= validHtmlStr($newMonitor['Deinterlacing']) ?>"/>
<?php <?php
} }
if ( $tab != 'timestamp' ) if ( $tab != 'timestamp' )
@ -663,6 +671,7 @@ switch ( $tab )
<tr><td><?= $SLANG['CaptureHeight'] ?> (<?= $SLANG['Pixels'] ?>)</td><td><input type="text" name="newMonitor[Height]" value="<?= validHtmlStr($newMonitor['Height']) ?>" size="4" onkeyup="updateMonitorDimensions(this);"/></td></tr> <tr><td><?= $SLANG['CaptureHeight'] ?> (<?= $SLANG['Pixels'] ?>)</td><td><input type="text" name="newMonitor[Height]" value="<?= validHtmlStr($newMonitor['Height']) ?>" size="4" onkeyup="updateMonitorDimensions(this);"/></td></tr>
<tr><td><?= $SLANG['PreserveAspect'] ?></td><td><input type="checkbox" name="preserveAspectRatio" value="1"/></td></tr> <tr><td><?= $SLANG['PreserveAspect'] ?></td><td><input type="checkbox" name="preserveAspectRatio" value="1"/></td></tr>
<tr><td><?= $SLANG['Orientation'] ?></td><td><select name="newMonitor[Orientation]"><?php foreach ( $orientations as $name => $value ) { ?><option value="<?= $value ?>"<?php if ( $value == $newMonitor['Orientation'] ) { ?> selected="selected"<?php } ?>><?= $name ?></option><?php } ?></select></td></tr> <tr><td><?= $SLANG['Orientation'] ?></td><td><select name="newMonitor[Orientation]"><?php foreach ( $orientations as $name => $value ) { ?><option value="<?= $value ?>"<?php if ( $value == $newMonitor['Orientation'] ) { ?> selected="selected"<?php } ?>><?= $name ?></option><?php } ?></select></td></tr>
<tr><td><?= "Deinterlacing" ?></td><td><select name="newMonitor[Deinterlacing]"><?php foreach ( $deinterlaceopts as $name => $value ) { ?><option value="<?= $value ?>"<?php if ( $value == $newMonitor['Deinterlacing'] ) { ?> selected="selected"<?php } ?>><?= $name ?></option><?php } ?></select></td></tr>
<?php <?php
break; break;
} }