Page 1 of 1

jpeg quality

Posted: Sun Mar 12, 2006 11:17 pm
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?

Posted: Wed Mar 15, 2006 11:28 pm
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:

Posted: Wed Mar 15, 2006 11:48 pm
by jameswilson
not a problem mate. I assumed i was missing something glaringly obvious

Possible Fix

Posted: Sat Mar 25, 2006 12:09 am
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

Posted: Mon Mar 27, 2006 10:06 am
by zoneminder
I'm curious why you have an extra set_quality call in there. Can you explain what this might do?

Posted: Mon Mar 27, 2006 11:40 am
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

Posted: Mon Mar 27, 2006 12:00 pm
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.

Posted: Mon Mar 27, 2006 12:54 pm
by tommy
Doesn't the set defaults undo the previous set quality?

thanks
tommy

Posted: Mon Mar 27, 2006 10:09 pm
by zoneminder
I think you may be right there, in which case I will need to do a bit more investigation.

Posted: Thu Mar 30, 2006 1:25 am
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

Posted: Thu Mar 30, 2006 9:55 pm
by zoneminder
This is fixed in 1.22.1. If you don't want to wait until then I can post a patch.