engrus

7-Zip plugins\MFilter

MFilter is a filter plugin for the popular 7-Zip archiver designed to deliver higher compression ratios to certain multimedia file types by means of automatic pre-processing. The filter itself does not provide compression, and requires co-use of a compressing codec.

Specifically, here is what MFilter does over the files being compressed:

  • The filter recompresses jpeg files using Brunsli or Lepton methods. This also applies to embedded thumbnails and jpeg files attached to or embedded into other files, like pdf.
  • The filter performs delta encoding of the following raster graphic file types:
    • uncompressed bmp
    • pnm (ppm, pgm, pam)
    • uncompressed tiff
    • uncompressed dng
    • uncompressed raw (3fr, arw, nef and others)
    • uncompressed tga
  • The filter uses the WavPack method to compress wav-files with uncompressed PCM audio. The following file types are automatically identified and compressed:
    • wav (including bwf/rf64 и Multiple Data Chunks (Legasy Audition Format) formats)
    • caf (Core Audio Format)
    • w64 (Sony Wave64)
    • dff (Philips DSDIFF)
    • dsf (Sony DSD stream)
    • aif, afc (Аudio Interchange File Format, including AIFF-C format)
    • sf2 (SoundFont)
  • The filter decodes data in BASE64 format.
  • The filter applies BCJ, ARM, ARMT, IA64, SPARC and PPC filters to the corresponding executables.

The below screenshot clearly shows how the compression rate improves after packing:

MFilter codec

Installation

The MFilter distribution package is a Zip file that contains two folders (named "32" and "64") and a ReadMe.txt file. The folders contain the 32-bit and 64-bit versions of MFilter, respectively. To install MFilter, first create a folder named "Codecs" in the 7-Zip installation folder. Then copy the files from the "32" or "64" folder, depending on the 7-Zip edition that you are using (32-bit or 64-bit), to the "Codecs" folder.

Usage

To use the filter, select the standard "Add to archive" command in 7-Zip and choose the 7z format in the Archive format field:

MFilter usage

Due to limitations of the 7-Zip interface you cannot select an additional filter directly, so in order to use MFilter you should add "f=mfilter" to the Parameters field. Configure other settings as you need.

Fine tuning

The filter offers some additional options to configure some aspects of pre-processing. Specify additional settings in the Parameters box in the following form: "f=mfilter:p1v1:p2v2", where p1 and p2 – are parameter names, and v1 and v2 are values of the corresponding parameters.

Block size

When data are compressed they are split into blocks. Increasing the size of a block may result in better compression rate, but also increases memory consumption during compressing. Memory consumption while uncompressing does not depend on the block size.

To set the block size, use the "c" key. For example, "c128m" sets the size of the block to 128 MB. The minimum value if 8 MB, maximum is 128 MB. The default value is 8 MB.

Jpeg compression algorithm

Use the "a" key to select a jpeg compression algorithm. Valid values are 0 and 1. 0 corresponds to Brunsil, 1 is for Lepton. By default, Brunsil is used because it delivers the optimal compression rate to performance ratio.

Also, you can use any external console jpeg packer to compress jpeg files. You will need to add the specific information about the packer to MFilter7z.ini. Basically, configuration of an external packer looks as follows:

[N]
Ext=EEE
Encode=packer.exe params "%1" "%2"
Decode=packer.exe params "%1" "%2"
PipeDecode=packer.exe params

N here is the value for the "a" key.

EEE is the extension the packer uses for files containing compressed jpeg files.

The Encode line is the command line to execute the packer when a jpeg file is compressed. The full path to the original jpeg file is substituted for %1 and the full path to the compressed file is substituted for %2.

The Decode line is the command line to execute the packer when a compressed jpeg file is unpacked. The full path to the compressed jpeg file is substituted for %1 and the full path to the unpacked jpeg file is substituted for %2.

Substituted names only differ by the file extension.

If the decoder supports streamed input/output, you can also define the PipeDecode line.

So, configuration of the PackJPG external decoder looks as follows:

[2]
Encode=packJPG.exe -np "%1"
Decode=packJPG.exe -np "%1"
Ext=pjg

Prediction algorithm

Packing of raster graphic files uses a special predication algorithm that attempts to predict subsequent pixels based on previous pixels. The filter can utilize one of eight possible algorithms:

 | | | | |
-+-+-+-+-+-
 | |C|B| |
-+-+-+-+-+-
 | |A|Y| |
-+-+-+-+-+-
 | | | | | 
  1. None
  2. Y = A
  3. Y = B
  4. Y = C
  5. Y = A + B - C
  6. Y = A + ((B - C) / 2)
  7. Y = B + ((A - C) / 2)
  8. Y = (A + B) / 2

Normally, the filter tries to select the best matching algorithm automatically, but you can set it explicitly by using the "pb" parameter. To select the best algorithm, the filter scans the first 200 lines of the image and makes selection based on statistics. You can redefine the number of lines to collect statistics using the "lp" parameter.

Logging

The filter has the logging mode. In this packing mode the filter creates a file named MFilter.log in the temporary folder. In this file the filter writes analysis data of the files being packed. To enable the logging mode, use the "o" key with the value of 1.

Current version

  • Plugin version: 1.1.2
  • Distribution package size: 3509 KB
  • Distribution package release date: 24 Jan 2021