jpeg quality

Support and queries relating to all previous versions of ZoneMinder
Locked
jameswilson
Posts: 5111
Joined: Wed Jun 08, 2005 8:07 pm
Location: Midlands UK

jpeg quality

Post by jameswilson »

Im sure i have read this soemwhere but i cant find it. The jpeg quality settings have gone from the settings page. I have altered them via webmin but they seem to have no effect (yes i restarted)

Is this known?
James Wilson

Disclaimer: The above is pure theory and may work on a good day with the wind behind it. etc etc.
http://www.securitywarehouse.co.uk
User avatar
zoneminder
Site Admin
Posts: 5215
Joined: Wed Jul 09, 2003 2:07 pm
Location: Bristol, UK
Contact:

Post by zoneminder »

If you altered them then they should take effect. The bug was that they were missing only though in a previous version I think the streaming used the file one by mistake.

I really really want to be able to find the time to get 1.22.1 out to get these niggly little bugs out of the way. :lol:
Phil
jameswilson
Posts: 5111
Joined: Wed Jun 08, 2005 8:07 pm
Location: Midlands UK

Post by jameswilson »

not a problem mate. I assumed i was missing something glaringly obvious
James Wilson

Disclaimer: The above is pure theory and may work on a good day with the wind behind it. etc etc.
http://www.securitywarehouse.co.uk
tommy
Posts: 45
Joined: Sun Aug 17, 2003 2:58 am

Possible Fix

Post by tommy »

This seems to be working for me:

Code: Select all

--- zm_image.cpp.original       2006-01-17 02:56:30.000000000 -0800
+++ zm_image.cpp        2006-03-24 15:37:13.000000000 -0800
@@ -270,6 +270,7 @@
                cinfo->in_color_space = JCS_RGB; /* colorspace of input image */
        }
        jpeg_set_defaults( cinfo );
+       jpeg_set_quality( cinfo, quality, false );
        cinfo->dct_method = JDCT_FASTEST;

        jpeg_start_compress( cinfo, TRUE );
@@ -354,7 +355,7 @@
                return( temp_image.EncodeJpeg( outbuffer, outbuffer_size, quality_override ) );
        }

-       int quality = quality_override?quality_override:config.jpeg_file_quality;
+       int quality = quality_override?quality_override:config.jpeg_image_quality;

        struct jpeg_compress_struct *cinfo = jpg_ccinfo[quality];

@@ -380,6 +381,7 @@
                cinfo->in_color_space = JCS_RGB; /* colorspace of input image */
        }
        jpeg_set_defaults( cinfo );
+       jpeg_set_quality( cinfo, quality, false );
        cinfo->dct_method = JDCT_FASTEST;

        jpeg_start_compress( cinfo, TRUE );
tommy
User avatar
zoneminder
Site Admin
Posts: 5215
Joined: Wed Jul 09, 2003 2:07 pm
Location: Bristol, UK
Contact:

Post by zoneminder »

I'm curious why you have an extra set_quality call in there. Can you explain what this might do?
Phil
tommy
Posts: 45
Joined: Sun Aug 17, 2003 2:58 am

Post by tommy »

I have one before the start compress in Image::WriteJpeg and one before the start compress in Image::EncodeJpeg. Is one of those redundant?

I was implementing what I read at http://apodeline.free.fr/DOC/libjpeg/libjpeg-2.html

"You can set all the parameters to reasonable defaults by calling jpeg_set_defaults(); then, if there are particular values you want to change, you can do so after that. The "Compression parameter selection" section tells about all the parameters.

You must set in_color_space correctly before calling jpeg_set_defaults(), because the defaults depend on the source image colorspace. However the other three source image parameters need not be valid until you call jpeg_start_compress(). There's no harm in calling jpeg_set_defaults() more than once, if that happens to be convenient."

Wasn't this how it was done in previous versions of ZM?

thanks
tommy
User avatar
zoneminder
Site Admin
Posts: 5215
Joined: Wed Jul 09, 2003 2:07 pm
Location: Bristol, UK
Contact:

Post by zoneminder »

There is a set_quality call just a bit further up when the cinfo structure is first created. AFAIK this should be all that is required. I didn't know if you knew that perhaps this wasn't the case.
Phil
tommy
Posts: 45
Joined: Sun Aug 17, 2003 2:58 am

Post by tommy »

Doesn't the set defaults undo the previous set quality?

thanks
tommy
User avatar
zoneminder
Site Admin
Posts: 5215
Joined: Wed Jul 09, 2003 2:07 pm
Location: Bristol, UK
Contact:

Post by zoneminder »

I think you may be right there, in which case I will need to do a bit more investigation.
Phil
User avatar
victor_diago
Posts: 245
Joined: Wed Jan 21, 2004 2:44 pm
Location: Brazil, sao paulo
Contact:

Post by victor_diago »

Hi all.

Unfortunatelly the JPEG_QUALITY doesnt work in this version.


i have tried a lot, ive changed manually in mysql but NO SUCCESS.


Does anyone have a clue on how to get it working ?


Thanks for now.


Victor Diago
User avatar
zoneminder
Site Admin
Posts: 5215
Joined: Wed Jul 09, 2003 2:07 pm
Location: Bristol, UK
Contact:

Post by zoneminder »

This is fixed in 1.22.1. If you don't want to wait until then I can post a patch.
Phil
Locked