# Assembler wave file compression

hi I need to compress a normal wave file in binary code, By using the start step and stop method

Start Step Stop code is a prefix code, with variable length.

It works as follows:

The length of the code is given by the number of 0's in the prefix. The prefix is ended with a 1, except in the case when the number of 0's equal STOP. The length is then (STEP * number 0's + START).

Thus for START=2 and STEP=2 and a code 001XXXXXX, the length is 2*2+2 = 6. A normal binary number of that length then follows the prefix.

In the case where we have maximum length, (length = STOP) we omit the 1, since we know we can't have any longer codes, and the binary value follows immediately. In the previous example, say STOP=6. Now the code becomes 00XXXXXX.

for the Stop value, the following must always hold: STOP=n*STEP+START where n any positive integer.

(1,2,5) Start-Step-Stop Codes

k Code k Code

0 1 0 9 01 111

1 1 1 10 00 00000

2 01 000 11 00 00001

3 01 001 12 00 00010

4 01 010 13 00 00011

5 01 011

6 01 100 39 00 11101

7 01 101 40 00 11110

8 01 110 41 00 11111

You can see the prefix as representing a base value, and the binary number is just added to the base to get the value the code represents. In the example,

Prefix Base
1 0

01 2

00 10

The number of codes that can be represented with a combination of SSS is given by

(2^(stop+step) - 2^start)/(2^step - 1)

If we start assigning numbers, from 0, to the codes, the largest number we can represent is one less than the number of codes.

The largest number we must be able to encode is: abs(2*(-256))+1=513.

When SSS values are specified, you must check that you can indeed encode that number with the SSS code. A SSS code that would work is 4-1-9

SSS codes are put on the output stream, one after another (see the output as a long stream of 1's and 0's). Because of their variable length, they will not begin or end on byte boundries all the time. This is a problem, since we can only move around data a byte at a time. You'll have to use the LSH and related instructions. Use a register or variable as a byte buffer, fill it up using LSH and write it to the file when the buffer is full.

If there's anyone who can help me with the problem I face could they please reply to this message as soon as possible

Sign In or Register to comment.

#### Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!