<s>
In	O
digital	B-Algorithm
image	I-Algorithm
processing	I-Algorithm
,	O
the	O
sum	B-Algorithm
of	I-Algorithm
absolute	I-Algorithm
differences	I-Algorithm
(	O
SAD	O
)	O
is	O
a	O
measure	O
of	O
the	O
similarity	O
between	O
image	O
blocks	B-General_Concept
.	O
</s>
<s>
It	O
is	O
calculated	O
by	O
taking	O
the	O
absolute	O
difference	O
between	O
each	O
pixel	B-Algorithm
in	O
the	O
original	O
block	O
and	O
the	O
corresponding	O
pixel	B-Algorithm
in	O
the	O
block	O
being	O
used	O
for	O
comparison	O
.	O
</s>
<s>
These	O
differences	O
are	O
summed	O
to	O
create	O
a	O
simple	O
metric	O
of	O
block	O
similarity	O
,	O
the	O
L1	O
norm	O
of	O
the	O
difference	O
image	O
or	O
Manhattan	O
distance	O
between	O
two	O
image	O
blocks	B-General_Concept
.	O
</s>
<s>
The	O
sum	B-Algorithm
of	I-Algorithm
absolute	I-Algorithm
differences	I-Algorithm
may	O
be	O
used	O
for	O
a	O
variety	O
of	O
purposes	O
,	O
such	O
as	O
object	O
recognition	O
,	O
the	O
generation	O
of	O
disparity	O
maps	O
for	O
stereo	B-Algorithm
images	O
,	O
and	O
motion	O
estimation	O
for	O
video	O
compression	O
.	O
</s>
<s>
This	O
example	O
uses	O
the	O
sum	B-Algorithm
of	I-Algorithm
absolute	I-Algorithm
differences	I-Algorithm
to	O
identify	O
which	O
part	O
of	O
a	O
search	O
image	O
is	O
most	O
similar	O
to	O
a	O
template	O
image	O
.	O
</s>
<s>
In	O
this	O
example	O
,	O
the	O
template	O
image	O
is	O
3	O
by	O
3	O
pixels	B-Algorithm
in	O
size	O
,	O
while	O
the	O
search	O
image	O
is	O
3	O
by	O
5	O
pixels	B-Algorithm
in	O
size	O
.	O
</s>
<s>
Each	O
pixel	B-Algorithm
is	O
represented	O
by	O
a	O
single	O
integer	O
from	O
0	O
to	O
9	O
.	O
</s>
<s>
To	O
calculate	O
the	O
SAD	O
values	O
,	O
the	O
absolute	O
value	O
of	O
the	O
difference	O
between	O
each	O
corresponding	O
pair	O
of	O
pixels	B-Algorithm
is	O
used	O
:	O
the	O
difference	O
between	O
2	O
and	O
2	O
is	O
0	O
,	O
4	O
and	O
1	O
is	O
3	O
,	O
7	O
and	O
8	O
is	O
1	O
,	O
and	O
so	O
forth	O
.	O
</s>
<s>
Calculating	O
the	O
values	O
of	O
the	O
absolute	O
differences	O
for	O
each	O
pixel	B-Algorithm
,	O
for	O
the	O
three	O
possible	O
template	O
locations	O
,	O
gives	O
the	O
following	O
:	O
</s>
<s>
From	O
these	O
SAD	O
values	O
,	O
it	O
could	O
be	O
asserted	O
that	O
the	O
right	O
side	O
of	O
the	O
search	O
image	O
is	O
the	O
most	O
similar	O
to	O
the	O
template	O
image	O
,	O
because	O
it	O
has	O
the	O
lowest	O
sum	B-Algorithm
of	I-Algorithm
absolute	I-Algorithm
differences	I-Algorithm
as	O
compared	O
to	O
the	O
other	O
two	O
locations	O
.	O
</s>
<s>
The	O
sum	B-Algorithm
of	I-Algorithm
absolute	I-Algorithm
differences	I-Algorithm
provides	O
a	O
simple	O
way	O
to	O
automate	O
the	O
searching	O
for	O
objects	O
inside	O
an	O
image	O
,	O
but	O
may	O
be	O
unreliable	O
due	O
to	O
the	O
effects	O
of	O
contextual	O
factors	O
such	O
as	O
changes	O
in	O
lighting	O
,	O
color	O
,	O
viewing	O
direction	O
,	O
size	O
,	O
or	O
shape	O
.	O
</s>
<s>
The	O
SAD	O
may	O
be	O
used	O
in	O
conjunction	O
with	O
other	O
object	O
recognition	O
methods	O
,	O
such	O
as	O
edge	B-Algorithm
detection	I-Algorithm
,	O
to	O
improve	O
the	O
reliability	O
of	O
results	O
.	O
</s>
<s>
SAD	O
is	O
an	O
extremely	O
fast	O
metric	O
due	O
to	O
its	O
simplicity	O
;	O
it	O
is	O
effectively	O
the	O
simplest	O
possible	O
metric	O
that	O
takes	O
into	O
account	O
every	O
pixel	B-Algorithm
in	O
a	O
block	O
.	O
</s>
<s>
Therefore	O
,	O
it	O
is	O
very	O
effective	O
for	O
a	O
wide	O
motion	O
search	O
of	O
many	O
different	O
blocks	B-General_Concept
.	O
</s>
<s>
SAD	O
is	O
also	O
easily	O
parallelizable	B-Operating_System
since	O
it	O
analyzes	O
each	O
pixel	B-Algorithm
separately	O
,	O
making	O
it	O
easily	O
implementable	O
with	O
such	O
instructions	O
as	O
ARM	O
NEON	O
or	O
x86	B-General_Concept
SSE2	I-General_Concept
.	O
</s>
<s>
For	O
example	O
,	O
SSE	O
has	O
packed	O
sum	B-Algorithm
of	I-Algorithm
absolute	I-Algorithm
differences	I-Algorithm
instruction	O
(	O
PSADBW	O
)	O
specifically	O
for	O
this	O
purpose	O
.	O
</s>
<s>
Once	O
candidate	O
blocks	B-General_Concept
are	O
found	O
,	O
the	O
final	O
refinement	O
of	O
the	O
motion	O
estimation	O
process	O
is	O
often	O
done	O
with	O
other	O
slower	O
but	O
more	O
accurate	O
metrics	O
,	O
which	O
better	O
take	O
into	O
account	O
human	O
perception	O
.	O
</s>
<s>
These	O
include	O
the	O
sum	B-Algorithm
of	I-Algorithm
absolute	I-Algorithm
transformed	I-Algorithm
differences	I-Algorithm
(	O
SATD	B-Algorithm
)	O
,	O
the	O
sum	B-Algorithm
of	I-Algorithm
squared	I-Algorithm
differences	I-Algorithm
(	O
SSD	O
)	O
,	O
and	O
rate-distortion	B-General_Concept
optimization	I-General_Concept
.	O
</s>
