After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 163323 - [pngenc] compression-level customisation support
[pngenc] compression-level customisation support
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins
git master
Other Linux
: Normal enhancement
: 0.8.8
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2005-01-08 11:46 UTC by Gergely Nagy
Modified: 2005-01-09 16:29 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch implementing a compression-level property. (2.71 KB, patch)
2005-01-08 11:47 UTC, Gergely Nagy
none Details | Review
Updated patch (2.60 KB, patch)
2005-01-09 12:02 UTC, Gergely Nagy
none Details | Review
Final patch (2.60 KB, patch)
2005-01-09 13:27 UTC, Gergely Nagy
none Details | Review

Description Gergely Nagy 2005-01-08 11:46:24 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.
Comment 1 Gergely Nagy 2005-01-08 11:47:59 UTC
Created attachment 35657 [details] [review]
Patch implementing a compression-level property.

ChangeLog entry prepended before the diff.
Comment 2 David Schleef 2005-01-09 05:12:02 UTC
Please don't use '-1' for special purposes.  GParams already have the concept of
a default.
Comment 3 Gergely Nagy 2005-01-09 12:02:58 UTC
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.
Comment 4 Gergely Nagy 2005-01-09 13:27:51 UTC
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)
Comment 5 Ronald Bultje 2005-01-09 16:29:15 UTC
Applied, thanks.