You are on page 1of 15

Block Truncation Coding (BTC)

Nimrod Peleg Update: Jan. 2006

Basic Idea
Originally: Preserve the first two sample moments of a small block (nxn)
Average: Standard Deviation:

1 x = 2 xi n n 2 2 = (x x )

Define a 1-bit (2-level quantizer: x+ and x-) with xTh, such that preserve the two moments

Two Level (binary) Quantizer


Output

x+
The rest of the information is in the Mean and the Standard deviation (SD) of the block !
XTh Input

x-

Advantages of BTC
Small complexity (faster than TC). Preserving edges. Each block can be compressed separately according to its variance. Fixed and Adaptive bit-allocation optional.

BTC Encoding
Assume a 512x512 image with 256 gray levels. The threshold will be the mean value (xave). For each block we transmit bit-level matrix, xsd and xave . The levels X+ and X- can be determined by setting up the expressions that equate (preserve) the moments before and after quantization.

Levels Selection
n x = n x n x
2 _ 2 2 2 + +

n x = n (x ) n (x )

+ 2

Where n+ and n- are the number of pixels above and below the threshold (mean)
n x = x n
+

n x = x + + n
+

Levels Selection (Contd)


Output levels are biased symmetrically around the mean level Both positive and negative biases are proportional to the SD Levels are rounded to the number of allowed bits, so moment preservation is not exact

BTC Example
136 27 144 172 83 43 x= 1 200 254 64 32 96 216 219 128 25
1 1 x' = 1 0 0 1 1 0 0 1 1 0 1 0 0 0

Mean=115
Thresholding
+ -

SD=77.93

X =193

X =37

n =n =8

BTC Decoding
From the moment preservation principle:
193 193 x rec = 193 37 37 37 193 37 193 37 37 37 193 193 193 37

For N-level reconstruction we use a Max-Lloyd Quantization !

Compression Ratio
The higher the block size - the higher the compression ratio For L bits-per-pixel we have n2L bits describing a nxn image Assuming that the mean and SD are defined also with b bits, we get a total number of (n2 + 2b) bits in the output:
bn 2 8* 4* 4 R(n) = 2 = =4 n + 2b 4* 4 + 16

Increasing Compression
Assigning only 6 bits to the mean and 4 bits to the SD: R=4.923 (1.625 bpp) Another option: assigning 10 bits together to the mean and SD, while the exact number of bits for the mean depends on the SD.

Compression ratio Vs. Block size


15 13 11 9

Compression ratio

16 bits 12 bits 8 bits

7 5

4 bits image (original)


3 1

10

12

14

16

Block size

Block Size=8, Bitrate=0.935bpp, Side information=0.25bpp, SNR=30dB

And in color

Source: Handbook of Image and Video Processing, Block Truncation Coding (BTC), Edward J. Delp, Martha Saenz, and Paul Salama

Other BTC techniques


Error criteria: Minimum MSE. Error criteria: Minimum MAE. Save 3rd order moment.