Colourises greyscale images to allow faster MPEG encoding.
git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@483 e3e1d417-86f3-4887-817a-d78f3d33393f
This commit is contained in:
parent
f780eccb5c
commit
183be298bd
|
@ -41,6 +41,7 @@
|
|||
|
||||
#define ZM_STRICT_VIDEO_CONFIG <from zmconfig> // Whether to allow errors in setting video config to be fatal
|
||||
#define ZM_LOCAL_BGR_INVERT <from zmconfig> // Invert BGR colours to RGB
|
||||
#define ZM_COLOUR_JPEG_FILES <from zmconfig> // Colourise greyscale JPEG files
|
||||
|
||||
#define ZM_JPEG_FILE_QUALITY <from zmconfig> // Set the JPEG quality setting for the saved event files
|
||||
#define ZM_JPEG_IMAGE_QUALITY <from zmconfig> // Set the JPEG quality setting for the streamed 'live' images
|
||||
|
|
|
@ -98,6 +98,14 @@ void Image::ReadJpeg( const char *filename )
|
|||
|
||||
void Image::WriteJpeg( const char *filename ) const
|
||||
{
|
||||
if ( ZM_COLOUR_JPEG_FILES && colours == 1 )
|
||||
{
|
||||
Image *temp_image = new Image( *this );
|
||||
temp_image->Colourise();
|
||||
temp_image->WriteJpeg( filename );
|
||||
return;
|
||||
}
|
||||
|
||||
struct jpeg_compress_struct cinfo;
|
||||
struct jpeg_error_mgr jerr;
|
||||
cinfo.err = jpeg_std_error(&jerr);
|
||||
|
@ -113,6 +121,7 @@ void Image::WriteJpeg( const char *filename ) const
|
|||
|
||||
cinfo.image_width = width; /* image width and height, in pixels */
|
||||
cinfo.image_height = height;
|
||||
|
||||
cinfo.input_components = colours; /* # of color components per pixel */
|
||||
if ( colours == 1 )
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue