Solved

# Arithmetic Coding

Posted on 2010-11-08
346 Views
Here is the question im having problems with, i dont know even where to start. All the examples dont use real numbers.

"A data sequence {0.47, 2.61, 1.63, -0.98, 0.23, 1.12} is first quantized by a scalar quantizer shown below, and then coded by the arithmetic coding. Assume the probabilities for the outputs of the quantizer are P(-1.5)=0.2, P(-0.5)=0.3, P(0.5)=0.4, P(1.5)=0.1, calculate the tag value to represent this data sequence."

example-5.png
0
Question by:stephen_c01
• 5
• 4

LVL 35

Assisted Solution

mccarl earned 500 total points
First you need to get the output of the quantizer for you input data sequence. So to start you off, the input sequence and out of quantizer would start with...

input = {0.47, 2.61, 1.63, -0.98, 0.23, 1.12}
output = {0.5, 1.5, 1.5, .......}

All I did there was to look on the graph for the input data (eg, the first in the sequence is 0.47), then go directly up from the input axis at that point to where you meet the line representing the quantizer function, and look across to see that at that input value, you get an output of 0.5. Repeat for the other items in the input sequence.

Now, that output sequence contains the "symbols" that you will encode, and the probabilities of getting each "symbol" is what was given to you, eg.

P(-1.5)=0.2, P(-0.5)=0.3, P(0.5)=0.4, P(1.5)=0.1

Check out this link, http://en.wikipedia.org/wiki/Arithmetic_coding in particular the section directly under the heading "Defining a model". This describes what to do with those probabilities and the sequence of symbols that I started working out above. Note: just because the wiki pages uses words for the symbols (such as NEUTRAL, NEGATIVE, etc) makes no difference to your situation, it is just that you have numbers to describe the symbols (such as -1.5, 0.5, etc)

If you still have questions about either of these steps, come back and let us know.

0

LVL 7

Author Comment

i think the quantization was my biggest problem, just to make sure the rest of the quantized values would be?

output = {0.5, 1.5, 1.5, -0.5, 0.5, 1.5}
0

LVL 35

Expert Comment

Yep! :) And I also went through and got an answer for the output of the encoding if you want to double check that too.
0

LVL 7

Author Comment

that would be great, im really having a blond moment with this.
0

LVL 35

Expert Comment

What have you got so far?
0

LVL 7

Author Comment

i got 0.49705 for the tag.

l0      0
u0      1
l1      0
u1      0.5
l2      0.45
u2      0.5
l3      0.495
u3      0.5
l4      0.496
u4      0.4975
l5      0.49675
u5      0.49735
l6      0.49675
u6      0.49735
0

LVL 35

Accepted Solution

mccarl earned 500 total points
I think from that that you are using the symbol name not their probabilities. The -1.5, -0.5, 0.5, 1.5 are just labels, their values have no other significance.

Therefore, the intervals for your 4 symbols are as follows:

-1.5 = [0, 0.2)
-0.5 = [0.2, 0.5)
0.5 = [0.5, 0.9)
1.5 = [0.9, 1)

Notice the size of the interval is equal to the probability of that symbol occurring.

Another way to look at it is too rename the symbols, say A = -1.5, B = -0.5, C = 0.5, D = 1.5 and then the problem transforms into the following...

quantized data sequence = {C, D, D, B, C, D}
P(A) = 0.2, P(B) = 0.3, P(C) = 0.4, P(D) = 0.1

and then you can go from there, as a hint the result should start off like this...
// Initial interval
l0      0
u0      1

// After first data item (0.5, or C in what I renamed above)
l1      0.5
u1      0.9

// After second data item....
l2      0.86
u2      0.9

.
.
.
.
0

LVL 7

Author Comment

i found an error.

l0      0
u0      1
l1      0.5
u1      0.9
l2      0.86
u2      0.9
l3      0.896
u3      0.9
l4      0.8968
u4      0.898
l5      0.8974
u5      0.89788
l6      0.90172
u6      0.89788

0.8998
0

LVL 35

Expert Comment

Everything except l6 is correct, the lower bound of the interval can't be higher than the upper bound. But it looks like you have the idea!!
0

## Featured Post

### Suggested Solutions

Iteration: Iteration is repetition of a process. A student who goes to school repeats the process of going to school everyday until graduation. We go to grocery store at least once or twice a month to buy products. We repeat this process every montâ€¦
This article seeks to propel the full implementation of geothermal power plants in Mexico as a renewable energy source.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filledâ€¦
This tutorial demonstrates a quick way of adding group price to multiple Magento products.