GNOME Bugzilla – Bug 163323
[pngenc] compression-level customisation support
Last modified: 2005-01-09 16:29:15 UTC
At the moment, pngenc sets compression level to 9, and there's no way to change it, except in the source code. That is unfortunate, as the libpng documentation says that compression levels 5 and 6 are usually just as fine and in my experience, significantly faster. Not to mention that I'd like to be able to save uncompressed PNG files. A patch to remedy the situation will be appended to this report.
Created attachment 35657 [details] [review] Patch implementing a compression-level property. ChangeLog entry prepended before the diff.
Please don't use '-1' for special purposes. GParams already have the concept of a default.
Created attachment 35715 [details] [review] Updated patch Changes compared to the original patch: - Does not use -1 for special purposes, the allowed range is now Z_NO_COMPRESSION (0) .. Z_BEST_COMPRESSION (9). The default compression level can be used by not touching the compression-level property at all. - Since the range is unsigned, use g_param_spec_uint() instead of _int(). - Instead of Z_DEFAULT_COMPRESSION, a hardcoded 6 is used (according to the zlib sources, that is used when Z_DEFAULT_COMPRESSION is seen) Patch generated against latest gst-plugins CVS.
Created attachment 35724 [details] [review] Final patch *sigh* The updated patch is broken, it mixes g_param_spec_uint() with g_value_(get|set)_int(), which is bad, and initializes ->compression_level to -1 (Z_DEFAULT_COMPRESSION), which is also bad. And pngdec->compression_level has a type of gint, which is not that bad, since it doesn't really matter as the range is 0..9 anyway, but doesn't look nice. This final patch corrects those problems. (Now I go and hide in a cave until I learn to test my patches more carefully)
Applied, thanks.