NCTAudioConvert ActiveX Control Version 1

NCTDataCompress ActiveX Control

Version 1.01

Properties

Methods

Events

The NCTDataCompress ActiveX Control allows to compress information in your application. It can compress as files, as data in memory.

Two modern and powerful methods of compression are used in this control: Burrows-Wheeler transform (BWT) method and Prediction of Partial Matching (PPM) method.

NCTDataCompress ActiveX Control compresses different types of files better on 20-50% than most popular compression utilities such as WinZip or WinRAR. See comparison analysis NCTDataCompress with WinZip and WinRAR.

You can insert NCTDataCompress ActiveX Control in your program, written on language, which supports ActiveX controls, for example MS Visual Basic, MS Visual C++, MS Visual FoxPro and others.


Properties

Algorithm | PPMMemSize
Reorder | PPMOrder
Status | KeyCode


Algorithm property

Returns or sets number of compression algorithm.

Syntax

object.Algorithm = [ Integer ]

The settings for return value are:

Setting | Description
1 | PPM (Prediction of Partial Matching) algorithm.
2 | BWT (Burrows-Wheeler transform) algorithm.


KeyCode Property

Returns or sets string with registration code.

Syntax

object.KeyCode [ = String]


PPMMemSize property

Returns or sets quantity of memory in Mbytes, which given for PPM method.

Syntax

object.PPMMemSize = [ Long ]

Remarks

This property can accept values from 4 to 40 Mbytes. By default it is sets to 10. Rate of compression depends from value of PPMMemSize.


PPMOrder property

Returns or sets order of context model for PPM method.

Syntax

object.PPMOrder = [ Long ]

Remarks

This property can accept values from 1 to 16. On default it is set to 5. Rate and speed of compression depend from value of PPMOrder.


Reorder property

Returns or sets reorder number.

Syntax

object.Reorder = [ Long ]

Remarks

This property can accept values from 1 to 256. On default it is set to 1. Increasing Reorder value above 1 can increase compression rate for some files types. It's recommended to set this property to 1 for text files, 2 for WAV (PCM 16 bit) and 3 for uncompressed BMP.


Status property

Returns current status of control.

Syntax

Long = object.Status

The settings for return value are:

Status code | Description
0 | No operation
1 | Encoding.
2 | Decoding.
3 | Forward reordering.
4 | Backward reordering.
5 | Getting CRC code.


Methods

Operations with files
OpenInputFile | ReadInputFile
CloseInputFile | CloseOutputFile
CreateOutputFile | WriteOutputFile
Operations with arrays
CompressByteArray | DecompressByteArray
GetArraySize | GetCRCCodeArray


CloseInputFile Method

Closes input file, opened before by OpenInputFile method.

Syntax

object.CloseInputFile ( )


CloseOutputFile Method

Closes output file, created before by CreateOutputFile method.

Syntax

object.CloseOutputFile ( )


CompressByteArray Method

Compresses byte array.

Syntax

outByteArray( ) = object.CompressByteArray (inpByteArray( ))

The CompressByteArray method syntax has the following parts:

Part | Type | Description
inpByteArray( ) | Byte | Input byte array.
outByteArray( ) | Byte | Output byte array.

See also

For decompressing byte array use DecompressByteArray method.


CreateOutputFile Method

Creates output file.

Syntax

object.CreateOutputFile (fileName)

The CreateOutputFile method syntax has the following parts:

Part | Type | Description
fileName | String | Pathname of output file.

See also

Use WriteOutputFile method for writing byte array to file, created by CreateOutputFile method.

Use CloseOutputFile method for closing file, created by CreateOutputFile method.


DecompressByteArray Method

Decompresses byte array.

Syntax

outByteArray( ) = object.DecompressByteArray (inpByteArray( ))

The DecompressByteArray method syntax has the following parts:

Part | Type | Description
inpByteArray( ) | Byte | Input byte array.
outByteArray( ) | Byte | Output byte array.

See also

For compressing byte array use CompressByteArray method.


GetArraySize Method

Returns size of byte array.

Syntax

size = object.GetArraySize (arByte( ))

The GetArraySize method syntax has the following parts:

Part | Type | Description
arByte( ) | Byte | Input byte array.
size | Long | Array size.


GetCRCCodeArray Method

Returns CRC code of byte arrray.

Syntax

size = object.GetCRCCodeArray (inpByteArray ( ))

The GetCRCCodeArray method syntax has the following parts:

Part | Type | Description
inpByteArray ( ) | Byte | Input byte array.
CRC | Long | CRC code of byte array.

Remarks

CRC (cyclic redundancy code) is used for checking of validity of the archive.


OpenInputFile Method

Opens input file for reading.

Syntax

fileSize = object.OpenInputFile (fileName)

The OpenInputFile method syntax has the following parts:

Part | Type | Description
fileName | String | Pathname of input file.
fileSize | Long | Size of input file (in bytes).

Remarks

If file doesn't exist or error was occurred while opening, this method returns -1 instead size of file.

See also

ReadInputFile method read byte array from file, opened by OpenInputFile method.

CloseInputFile method closes file, opened by OpenInputFile method.


ReadInputFile Method

Read byte array from starting position of opened input file.

Syntax

outByteArray( ) = object.ReadInputFile (startPos , nSamples)

The ReadInputFile method syntax has the following parts:

Part | Type | Description
startPos | Long | Starting position in file.
nSamples | Long | Quantity of read samples.
outByteArray( ) | Byte | Output byte array.

See also

OpenInputFile method should be applied before ReadInputFile method.


WriteOutputFile Method

Writes byte array to output file.

Syntax

object.WriteOutputFile (inpByteArray( ))

The WriteOutputFile method syntax has the following parts:

Part | Type | Description
inpByteArray( ) | Byte | Input byte array.

See also

CreateOutputFile method should be applied before WriteOutputFile method.


Events

CompressBlock
DecompressBlock


CompressBlock Event

Occurs when block is completed in compression process.

Syntax

Private Sub object_CompressBlock (Percent)

The CompressBlock event syntax has the following parts:

Part | Type | Description
Percent | Long | Percent of compression.


DecompressBlock Event

Occurs when block is completed in decompression process.

Syntax

Private Sub object_DecompressBlock (Percent)

The DecompressBlock event syntax has the following parts:

Part | Type | Description
Percent | Long | Percent of decompression.


Glossary

BWT (Burrows-Wheeler transform) method

PPM (Prediction of Partial Matching) method

CRC (Cyclic Redundancy Code)


CRC

BWT (Burrows-Wheeler transform) method

"Block Sorting treats a body of text as a large block of strings. The strings can be sorted using a reversible algorithm of some kind, yielding a more compressible dataset. The best known example of this technique is the Burrows-Wheeler Transform, or BWT.

The Burrows-Wheeler Transform refers to a reversible transformation that can make a given text more compressible. Once this transform has been applied, the text can be compressed with a combination of Move to Front encoding followed by an entropy encoder."

From http://www.dogma.net/DataCompression


CRC

CRC (Cyclic Redundancy Code)

"The aim of an error detection technique is to enable the receiver of a message transmitted through a noisy (error-introducing) channel to determine whether the message has been corrupted. To do this, the transmitter constructs a value (called a checksum) that is a function of the message, and appends it to the message. The receiver can then use the same function to calculate the checksum of the received message and compare it with the appended checksum to see if the message was correctly received.

The basic idea of CRC algorithms is simply to treat the message as an enormous binary number, to divide it by another fixed binary number, and to make the remainder from this division the checksum. Upon receipt of the message, the receiver can perform the same division and compare the remainder with the "checksum" (transmitted remainder)."

From Ross N. Williams "A Painless guide to CRC error detection algorithms"


PPM

PPM (Prediction of Partial Matching) method

"PPM is a specialized form of compression based on Markov modeling. In general, PPM predicts the probability of a given character based on a given number of characters that immediately precede it. PPM is conceptually simple, but often computationally expensive."

From http://www.dogma.net/DataCompression


Comparison of compression rate

Calgary corpus
File | Original size (bytes) | Compression size (bytes)
 |  | NCTDataCompress |  | WinRAR 2.71 (max. compression) | WinZip 8.0 (max. compression)
 |  | PPM method | BWT method
bib | 111261 | 24526 | 27253 | 32815 | 34983
book1 | 768771 | 211807 | 223686 | 275145 | 312368
book2 | 610856 | 144043 | 152615 | 179870 | 206247
geo* | 102400 | 50178 | 51054 | 66632 | 69496
news | 377109 | 106546 | 115944 | 125674 | 144488
obj1 | 21504 | 9549 | 10441 | 9871 | 10403
obj2 | 246814 | 71039 | 74992 | 73191 | 81170
paper1 | 53161 | 14826 | 16402 | 18134 | 18630
paper2 | 82199 | 22626 | 24761 | 28561 | 29753
paper3 | 46526 | 14333 | 15705 | 17814 | 18159
paper4 | 13286 | 4615 | 5162 | 5558 | 5619
paper5 | 11954 | 4295 | 4781 | 5016 | 6081
paper6 | 38105 | 10988 | 12236 | 13122 | 13300
pic* | 513216 | 30107 | 30469 | 49152 | 52463
progc | 39611 | 11214 | 12434 | 13178 | 13347
progl | 71646 | 14217 | 15347 | 15798 | 16249
progp | 49379 | 9960 | 10610 | 10807 | 11271
trans | 93695 | 16069 | 17497 | 17973 | 18946
Total | 3251493 | 770938 | 821389 | 958311 | 1062973

Cantbury corpus
File | Original size (bytes) | Compression size (bytes)
 |  | NCTDataCompress |  | WinRAR 2.71 (max. compression) | WinZip 8.0 (max. compression)
 |  | PPM method | BWT method
alice29.txt | 152089 | 39354 | 42269 | 51017 | 54281
asyoulik.txt | 125179 | 36459 | 39060 | 46769 | 48921
cp.html | 24603 | 6652 | 7549 | 7961 | 8068
fields.c | 11150 | 2710 | 3003 | 3145 | 3224
grammar.lsp | 3721 | 1074 | 1247 | 1300 | 1336
kennedy.xls* | 1029744 | 34399 | 22861 | 119848 | 209823
lcet10.txt | 426754 | 98034 | 104426 | 126160 | 144518
plrabn12.txt | 481861 | 133021 | 141742 | 175016 | 194368
ptt5 | 513216 | 49349 | 46509 | 49102 | 52465
sum | 38240 | 11891 | 12489 | 11742 | 12854
xargs.1 | 4227 | 1511 | 1716 | 1803 | 1843
Total | 2810784 | 414454 | 422871 | 547863 | 731701

Sound files
File | Original size (bytes) | Compression size (bytes)
 |  | NCTDataCompress |  | WinRAR 2.71 (max. compression) | WinZip 8.0 (max. compression)
 |  | PPM method | BWT method
every.wav | 6994092 | 6381012 | 6229928 | 6720811 | 6702628
mike.wav | 1708300 | 875836 | 849772 | 1151045 | 1218723
Total | 8702392 | 7256848 | 7079700 | 7871856 | 7921351

Remarks

  • You can get Calgary and Cantbury test files from http://corpus.canterbury.ac.nz/fileset.html
    and sound files from: http://web.act.by.net/~act/act-files.html
  • Parameters of NCTDataCompress was set by default (Reorder=1, PPMOrder=5), except files, marked with *:
    geo - Reorder=2,
    pic - Reorder=216,
    kennedy.xls - Reorder=13,
    every.wav -Reorder=2,
    mike.wav - Reorder=2.


FAQ NCTACMConvert

NCTDataCompress

FAQ: Frequently Asked Questions

  1. Who is the product aimed at? Who should use it?

  2. What problems will it solve?

  3. How does it work?

  4. Is it designed to complement the rest of your product line?

  5. What sort of data is it designed to compress?

  6. Which method is better: PPM or BWT?

  7. What value should I assign to PPMOrder property?

  8. What value should I assign to Reorder property?
  1. Who is the product aimed at? Who should use it?

    This product aimed at the following categories of developers:
    1. Who want to incorporate compression possibility in their program, but
    don't want to use standard formats as .zip or .rar.
    2. Who want to develop and distribute their own compression utilities.
    3. Who want to add support of our format in their own compression utilities.
    4. Who need in compression data on the fly, i.e. in memory of computer, for
    example to sending compression data through Internet.

  2. What problems will it solve?

    Our product can solve next problems:
    1. Increase speed of transfer through Internet by compressing sending data.
    2. Increase your free space on HD by compressing any kind of files on your HD.
    3. Decrease size of you data, which you use in your application by compressing information in it.

  3. How does it work?

    Do you mean how you work compression? In our component we use two known methods: PPM (Prediction of Partial Matching) method and Burrows-Wheeler Transform method. There are many publications about these methods. For more information about compression you can see very good site: http://www.dogma.net/DataCompression/

  4. Is it designed to complement the rest of your product line?

    On the first look it stands outside from rest of our products. Almost all our products are assigned for multimedia, particularly for sound processing. But we have intention to use this experience, which we get by working on NCTDataCompress for compression multimedia: audio, video and images. Now we have ALF ACM driver for compressing audio files and we are going to enhance its quality and compression rate using this experience.

  5. What sort of data is it designed to compress?

    You can compress any sort of data using NCTDataCompress: text files, sound files, spreadsheets, html and others. Except this you can compress any information in memory of computer.

  6. Which method is better: PPM or BWT?

    Each method has his own advantages. Generally PPM has compression rate more than BWT for most well structured file types. But for some binary files BWT is better than PPM method (see comparison analysis).

  7. What value should I assign to PPMOrder property?

    PPMOrder is a context model order. Increasing PPMOrder increases compression rate, but decreases compression and decompression speed. But from some value, depended from the file type (for example for text files it is 5-6), compression rate achieves feeding and stops increasing.

  8. What value should I assign to Reorder property?

    It depends from file type. If information keeps in file as 8 bits units (for example chars in text file), then Reorder should be set to 1, if units have 16 bits (16 bit WAV files), then Reorder should be set to 2, for BMP (24 bit pixels), you can set Reorder to 3. In many cases it gives increasing compression rate.


About

NCTDataCompress
was developed by NCT company

http://www.nctsoft.com

Programmer: | Lev Bannov
Technical writer: | Alexander Konioukhov
Technical support: | support@nctsoft.com