# Difference between revisions of "Mean Removal"

m (→Theory: clarify rounding) |
m |
||

Line 11: | Line 11: | ||

Add the elements and divide by the number of elements to obtain the vector mean (only use the integer portion of the quotient, i.e., round towards 0): | Add the elements and divide by the number of elements to obtain the vector mean (only use the integer portion of the quotient, i.e., round towards 0): | ||

(17 | (17 24 18 16 11 25 20 17 12 20 22 19 15 19 23 21) / 16 = 299 / 16 = 18 | ||

For the mean removal part, subtract the mean of 18 from each element in the vector: | For the mean removal part, subtract the mean of 18 from each element in the vector: |

## Revision as of 19:50, 10 April 2007

Mean removal is another one of those concepts -- like differential coding -- that sounds like it would be difficult to understand. It’s not.

## Theory

What is a mean? It’s an average. It’s the sum of n items divided by n. Not difficult. Removal in this context is just mathematical subtraction. To remove a mean from, say, a vector of numbers, sum the numbers, divide the sum by the number of elements in the vector, and subtract that number from each element in the vector. An example vector:

17 24 18 16 11 25 20 17 12 20 22 19 15 19 23 21

Add the elements and divide by the number of elements to obtain the vector mean (only use the integer portion of the quotient, i.e., round towards 0):

(17 24 18 16 11 25 20 17 12 20 22 19 15 19 23 21) / 16 = 299 / 16 = 18

For the mean removal part, subtract the mean of 18 from each element in the vector:

-1 6 0 -2 -7 7 2 -1 -6 2 4 1 -3 1 5 3

This is the mean-removed vector. Just as with differential coding, the primary purpose is to make the numbers small. From here, the video codec needs to figure out efficient ways to transmit the mean-removed vector (also called the residual) as well as the vector mean. Encoding the residual will often result in information loss. However, the most significant number is the mean of the whole vector which should be transmitted losslessly.

## What A Multimedia Hacker Needs To Know

Mean removal seems to be pretty rare in production video codecs. One known codec that employs the technique is Sorenson Video 1.