Intel® Integrated Performance Primitives
Community support and discussions relating to developing high-performance vision, signal, security, and storage applications.
Announcements
This community is designed for sharing of public information. Please do not share Intel or third-party confidential information here.
6628 Discussions

Default compression level in IPP zlib sample

Ryan_Wong
Beginner
152 Views

I noticed this code in the IPP ZLIB sample when comparing with the public zlib 1.2.5 source. Can anyone explain the significance of "avoiding" level 6? Thanks.

[cpp]#ifdef IPP_DEFAULT_COMPRESSION
    if ((level == Z_DEFAULT_COMPRESSION) || (level == 6)) level = 5;
#else
[/cpp]
0 Kudos
1 Solution
Naveen_G_Intel
Employee
152 Views

Hi Ryan Wong,

To match with Zlib library, IPP Zlib compression levels are changed since form IPP 7.0.

Now level 6 is default as in the Zlib, as Sergey said, to make it faster with a less degree ofcompression enforcing to level 5.

If you want to match as in the previous releases of IPP, just change configuration_table structure.

/* 6 */ {8, 16, 128, 128, deflate_slow},
/* 5 */ {8, 16, 32, 32, deflate_slow},

#ifdef IPP_DEFAULT_COMPRESSION
if ((level == Z_DEFAULT_COMPRESSION) || (level == 6)) level = 5;
#else
if (level == Z_DEFAULT_COMPRESSION) level = 6;
#endif

New compression levels are described in the article.

http://software.intel.com/en-us/articles/ipp_zlib-change-the-default-compression-level-1/

Thanks,

Naveen Gv

View solution in original post

2 Replies
SergeyKostrov
Valued Contributor II
152 Views
Quoting Ryan Wong
...

I noticed this code in the IPP ZLIB sample when comparing with the public zlib 1.2.5 source. Can anyone explain the significance of "avoiding" level 6?
...


Hi Rayn,

Here are some pieces to the "puzzle" I found in 'zlib.h':

...
#define Z_NO_COMPRESSION 0
#define Z_BEST_SPEED 1
#define Z_BEST_COMPRESSION 9
#define Z_DEFAULT_COMPRESSION (-1)
/* compression levels */
...
and
...
The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9:
1 gives best speed, 9 gives best compression, 0 gives no compression at
all (the input data is simply copied a block at a time).
Z_DEFAULT_COMPRESSION requests a default compromise between speed and
compression ( currently equivalent to level 6 ).
... ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

By enforcing a value'5' a datacompression will be done a little bit faster with a less degree ofcompression.

It looks like a developer simply didn't want to allowa default compression level( -1 or 6 )at all.

Best regards,
Sergey

Naveen_G_Intel
Employee
153 Views

Hi Ryan Wong,

To match with Zlib library, IPP Zlib compression levels are changed since form IPP 7.0.

Now level 6 is default as in the Zlib, as Sergey said, to make it faster with a less degree ofcompression enforcing to level 5.

If you want to match as in the previous releases of IPP, just change configuration_table structure.

/* 6 */ {8, 16, 128, 128, deflate_slow},
/* 5 */ {8, 16, 32, 32, deflate_slow},

#ifdef IPP_DEFAULT_COMPRESSION
if ((level == Z_DEFAULT_COMPRESSION) || (level == 6)) level = 5;
#else
if (level == Z_DEFAULT_COMPRESSION) level = 6;
#endif

New compression levels are described in the article.

http://software.intel.com/en-us/articles/ipp_zlib-change-the-default-compression-level-1/

Thanks,

Naveen Gv

Reply