ArticleslgStudy

computer science

Block Truncation Coding

Block Truncation Coding is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Block Truncation Coding rather than just read about it. In short: Block Truncation Coding (BTC) is a type of lossy image compression technique for greyscale images. It divides the original images into blocks and then uses a quantizer to reduce the number of grey levels in each block whilst maintaining the same mean and standard deviation.

Key takeaways

  • Block Truncation Coding belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Block Truncation Coding to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Block Truncation Coding from memory before moving on to harder problems.

Reference excerpt

Block Truncation Coding (BTC) is a type of lossy image compression technique for greyscale images. It divides the original images into blocks and then uses a quantizer to reduce the number of grey levels in each block whilst maintaining the same mean and standard deviation. It is an early predecessor of the popular hardware DXTC technique, although BTC compression method was first adapted to color long before DXTC using a very similar approach called Color Cell Compression. BTC has also been adapted to video compression. BTC was first proposed by Professors Mitchell and Delp at Purdue University. Another variation of BTC is Absolute Moment Block Truncation Coding or AMBTC, in which instead of using the standard deviation the first absolute moment is preserved along with the mean. AMBTC is computationally simpler than BTC and also typically results in a lower Mean Squared Error (MSE). AMBTC was proposed by Maximo Lema and Robert Mitchell. Using sub-blocks of 4×4 pixels gives a compression ratio of 4:1 assuming 8-bit integer values are used during transmission or storage. Larger blocks allow greater compression ("a" and "b" values spread over more pixels) however quality also reduces with the increase in block size due to the nature of the algorithm. The BTC algorithm was used for compressing Mars Pathfinder's rover images.

Compression procedure A pixel image is divided into blocks of typically 4×4 pixels. For each block the Mean and Standard Deviation of the pixel values are calculated; these statistics generally change from block to block. The pixel values selected for each reconstructed, or new, block are chosen so that each block of the BTC compressed image will have (approximately) the same mean and standard deviation as the corresponding block of the original image. A two level quantization on the block is where we gain the compression and is performed as follows: y(i,j)={1,x(i,j)>x¯0,x(i,j)≤x¯ Here x(i,j) are pixel elements of the original block and y(i,j) are elements of the compressed block. In words this can be explained as: If a pixel value is greater than the mean it is assigned the value "1", otherwise "0". Values equal to the mean can have either a "1" or a "0" depending on the preference of the person or organisation implementing the algorithm. This 16-bit block is stored or transmitted along with the values of Mean and Standard Deviation. Reconstruction is made with two values "a" and "b" which preserve the mean and the standard deviation. The values of "a" and "b" can be computed as follows: a=x¯−σqm−q b=x¯+σm−qq Where σ is the standard deviation, m is the total number of pixels in the block and q is the number of pixels greater than the mean (x¯) To reconstruct the image, or create its approximation, elements assigned a 0 are replaced with the "a" value and elements assigned a 1 are replaced with the "b" value. x(i,j)={a,y(i,j)=0b,y(i,j)=1 This demonstrates that the algorithm is asymmetric in that the encoder has much more work to do than the decoder. This is because the decoder is simply replacing 1's and 0's with the estimated value whereas the encoder is also required to calculate the mean, standard deviation and the two values to use.

Example

Encoder Take a 4×4 block from an image, in this case the mountain test image: 245239249239245245239235245245245245245235235239 Like any small block from an image this appears rather boring to work with as the numbers are all quite similar, this is the nature of lossy compression and how it can work so well for images. Now we need to calculate two values from this data, that is the mean and standard deviation. The mean can be computed to 241.875, this is a simple calculation which should require no further explanation. The standard deviation is easily calculated at 4.36. From this the values of "a" and "b" can be calculated using the previous equations. They come out to be 236.935 and 245.718 respectively. The last calculation that needs to be done on the encoding side is to set the matrix to transmit to 1's and 0's so that each pixel can be transmitted as a single bit. 1010110011111000

Decoder Now at the decoder side all we need to do is reassign the "a" and "b" values to the 1 and 0 pixels. This will give us the following block: 245236245236245245236236245245245245245236236236 As can be seen, the block has been reconstructed with the two values of "a" and "b" as integers (because images aren't defined to store floating point numbers). When working through the theory, this is a good point to calculate the mean and standard deviation of the reconstructed block. They should equal the original mean and standard deviation. Remember to use integers, otherwise much quantization error will become involved, as we previously quantized everything to integers in the encoder.

See also Color Cell Compression ( a newer derivative of Block Truncation Coding )

References

External links Media related to Block Truncation Coding at Wikimedia Commons

Worked examples

Example 1 — a first encounter with Block Truncation Coding

Start with the simplest possible case. Write down what Block Truncation Coding claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Block Truncation Coding before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Block Truncation Coding ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Block Truncation Coding

In research
Block Truncation Coding appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Block Truncation Coding in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Block Truncation Coding is common in secondary-school and first-year university syllabi. It links to neighbouring topics Image compression, Lossy compression algorithms, so understanding it makes those chapters shorter.
In everyday life
Look for Block Truncation Coding outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Block Truncation Coding” →

How to study Block Truncation Coding in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Block Truncation Coding means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Block Truncation Coding out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Block Truncation Coding in simple terms?

Block Truncation Coding (BTC) is a type of lossy image compression technique for greyscale images. It divides the original images into blocks and then uses a quantizer to reduce the number of grey levels in each block whilst maintaining the same mean and standard deviation.

Why does Block Truncation Coding matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Block Truncation Coding?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Block Truncation Coding.

Tags

  • Image compression
  • Lossy compression algorithms

Keep exploring