<s>
Block	B-Algorithm
Truncation	I-Algorithm
Coding	I-Algorithm
(	O
BTC	O
)	O
is	O
a	O
type	O
of	O
lossy	B-Algorithm
image	I-Algorithm
compression	I-Algorithm
technique	O
for	O
greyscale	O
images	O
.	O
</s>
<s>
It	O
divides	O
the	O
original	O
images	O
into	O
blocks	O
and	O
then	O
uses	O
a	O
quantizer	O
to	O
reduce	O
the	O
number	O
of	O
grey	O
levels	O
in	O
each	O
block	O
whilst	O
maintaining	O
the	O
same	O
mean	O
and	O
standard	B-General_Concept
deviation	I-General_Concept
.	O
</s>
<s>
It	O
is	O
an	O
early	O
predecessor	O
of	O
the	O
popular	O
hardware	O
DXTC	O
technique	O
,	O
although	O
BTC	O
compression	O
method	O
was	O
first	O
adapted	O
to	O
color	O
long	O
before	O
DXTC	O
using	O
a	O
very	O
similar	O
approach	O
called	O
Color	B-Algorithm
Cell	I-Algorithm
Compression	I-Algorithm
.	O
</s>
<s>
Another	O
variation	O
of	O
BTC	O
is	O
Absolute	O
Moment	O
Block	B-Algorithm
Truncation	I-Algorithm
Coding	I-Algorithm
or	O
AMBTC	O
,	O
in	O
which	O
instead	O
of	O
using	O
the	O
standard	B-General_Concept
deviation	I-General_Concept
the	O
first	O
absolute	O
moment	O
is	O
preserved	O
along	O
with	O
the	O
mean	O
.	O
</s>
<s>
Using	O
sub-blocks	O
of	O
4×4	O
pixels	B-Algorithm
gives	O
a	O
compression	O
ratio	O
of	O
4:1	O
assuming	O
8-bit	O
integer	O
values	O
are	O
used	O
during	O
transmission	O
or	O
storage	O
.	O
</s>
<s>
Larger	O
blocks	O
allow	O
greater	O
compression	O
(	O
"	O
a	O
"	O
and	O
"	O
b	O
"	O
values	O
spread	O
over	O
more	O
pixels	B-Algorithm
)	O
however	O
quality	O
also	O
reduces	O
with	O
the	O
increase	O
in	O
block	O
size	O
due	O
to	O
the	O
nature	O
of	O
the	O
algorithm	O
.	O
</s>
<s>
A	O
pixel	B-Algorithm
image	O
is	O
divided	O
into	O
blocks	O
of	O
typically	O
4×4	O
pixels	B-Algorithm
.	O
</s>
<s>
For	O
each	O
block	O
the	O
Mean	O
and	O
Standard	B-General_Concept
Deviation	I-General_Concept
of	O
the	O
pixel	B-Algorithm
values	O
are	O
calculated	O
;	O
these	O
statistics	O
generally	O
change	O
from	O
block	O
to	O
block	O
.	O
</s>
<s>
The	O
pixel	B-Algorithm
values	O
selected	O
for	O
each	O
reconstructed	O
,	O
or	O
new	O
,	O
block	O
are	O
chosen	O
so	O
that	O
each	O
block	O
of	O
the	O
BTC	O
compressed	O
image	O
will	O
have	O
(	O
approximately	O
)	O
the	O
same	O
mean	O
and	O
standard	B-General_Concept
deviation	I-General_Concept
as	O
the	O
corresponding	O
block	O
of	O
the	O
original	O
image	O
.	O
</s>
<s>
Here	O
are	O
pixel	B-Algorithm
elements	O
of	O
the	O
original	O
block	O
and	O
are	O
elements	O
of	O
the	O
compressed	O
block	O
.	O
</s>
<s>
In	O
words	O
this	O
can	O
be	O
explained	O
as	O
:	O
If	O
a	O
pixel	B-Algorithm
value	O
is	O
greater	O
than	O
the	O
mean	O
it	O
is	O
assigned	O
the	O
value	O
"	O
1	O
"	O
,	O
otherwise	O
"	O
0	O
"	O
.	O
</s>
<s>
This	O
16-bit	O
block	O
is	O
stored	O
or	O
transmitted	O
along	O
with	O
the	O
values	O
of	O
Mean	O
and	O
Standard	B-General_Concept
Deviation	I-General_Concept
.	O
</s>
<s>
Reconstruction	O
is	O
made	O
with	O
two	O
values	O
"	O
a	O
"	O
and	O
"	O
b	O
"	O
which	O
preserve	O
the	O
mean	O
and	O
the	O
standard	B-General_Concept
deviation	I-General_Concept
.	O
</s>
<s>
This	O
is	O
because	O
the	O
decoder	O
is	O
simply	O
replacing	O
1	O
's	O
and	O
0	O
's	O
with	O
the	O
estimated	O
value	O
whereas	O
the	O
encoder	O
is	O
also	O
required	O
to	O
calculate	O
the	O
mean	O
,	O
standard	B-General_Concept
deviation	I-General_Concept
and	O
the	O
two	O
values	O
to	O
use	O
.	O
</s>
<s>
Like	O
any	O
small	O
block	O
from	O
an	O
image	O
this	O
appears	O
rather	O
boring	O
to	O
work	O
with	O
as	O
the	O
numbers	O
are	O
all	O
quite	O
similar	O
,	O
this	O
is	O
the	O
nature	O
of	O
lossy	B-Algorithm
compression	I-Algorithm
and	O
how	O
it	O
can	O
work	O
so	O
well	O
for	O
images	O
.	O
</s>
<s>
Now	O
we	O
need	O
to	O
calculate	O
two	O
values	O
from	O
this	O
data	O
,	O
that	O
is	O
the	O
mean	O
and	O
standard	B-General_Concept
deviation	I-General_Concept
.	O
</s>
<s>
The	O
standard	B-General_Concept
deviation	I-General_Concept
is	O
easily	O
calculated	O
at	O
4.36	O
.	O
</s>
<s>
The	O
last	O
calculation	O
that	O
needs	O
to	O
be	O
done	O
on	O
the	O
encoding	O
side	O
is	O
to	O
set	O
the	O
matrix	O
to	O
transmit	O
to	O
1	O
's	O
and	O
0	O
's	O
so	O
that	O
each	O
pixel	B-Algorithm
can	O
be	O
transmitted	O
as	O
a	O
single	O
bit	O
.	O
</s>
<s>
Now	O
at	O
the	O
decoder	O
side	O
all	O
we	O
need	O
to	O
do	O
is	O
reassign	O
the	O
"	O
a	O
"	O
and	O
"	O
b	O
"	O
values	O
to	O
the	O
1	O
and	O
0	O
pixels	B-Algorithm
.	O
</s>
<s>
When	O
working	O
through	O
the	O
theory	O
,	O
this	O
is	O
a	O
good	O
point	O
to	O
calculate	O
the	O
mean	O
and	O
standard	B-General_Concept
deviation	I-General_Concept
of	O
the	O
reconstructed	O
block	O
.	O
</s>
<s>
They	O
should	O
equal	O
the	O
original	O
mean	O
and	O
standard	B-General_Concept
deviation	I-General_Concept
.	O
</s>
