<s>
Rate-distortion	B-General_Concept
optimization	I-General_Concept
(	O
RDO	O
)	O
is	O
a	O
method	O
of	O
improving	O
video	B-Device
quality	I-Device
in	O
video	O
compression	O
.	O
</s>
<s>
The	O
name	O
refers	O
to	O
the	O
optimization	O
of	O
the	O
amount	O
of	O
distortion	O
(	O
loss	O
of	O
video	B-Device
quality	I-Device
)	O
against	O
the	O
amount	O
of	O
data	O
required	O
to	O
encode	O
the	O
video	O
,	O
the	O
rate	O
.	O
</s>
<s>
While	O
it	O
is	O
primarily	O
used	O
by	O
video	O
encoders	O
,	O
rate-distortion	B-General_Concept
optimization	I-General_Concept
can	O
be	O
used	O
to	O
improve	O
quality	O
in	O
any	O
encoding	O
situation	O
(	O
image	O
,	O
video	O
,	O
audio	O
,	O
or	O
otherwise	O
)	O
where	O
decisions	O
have	O
to	O
be	O
made	O
that	O
affect	O
both	O
file	O
size	O
and	O
quality	O
simultaneously	O
.	O
</s>
<s>
and	O
in	O
particular	O
regarding	O
the	O
use	O
of	O
quarter	B-Algorithm
pixel-precision	I-Algorithm
motion	I-Algorithm
estimation	I-Algorithm
.	O
</s>
<s>
Adding	O
the	O
extra	O
precision	O
to	O
the	O
motion	O
of	O
a	O
block	B-General_Concept
during	O
motion	O
estimation	O
might	O
increase	O
quality	O
,	O
but	O
in	O
some	O
cases	O
that	O
extra	O
quality	O
is	O
n't	O
worth	O
the	O
extra	O
bits	O
necessary	O
to	O
encode	O
the	O
motion	O
vector	O
to	O
a	O
higher	O
precision	O
.	O
</s>
<s>
Rate-distortion	B-General_Concept
optimization	I-General_Concept
solves	O
the	O
aforementioned	O
problem	O
by	O
acting	O
as	O
a	O
video	B-Device
quality	I-Device
metric	O
,	O
measuring	O
both	O
the	O
deviation	O
from	O
the	O
source	O
material	O
and	O
the	O
bit	O
cost	O
for	O
each	O
possible	O
decision	O
outcome	O
.	O
</s>
<s>
The	O
deviation	O
from	O
the	O
source	O
is	O
usually	O
measured	O
as	O
the	O
mean	B-Algorithm
squared	I-Algorithm
error	I-Algorithm
,	O
in	O
order	O
to	O
maximize	O
the	O
PSNR	O
video	B-Device
quality	I-Device
metric	O
.	O
</s>
<s>
Calculating	O
the	O
bit	O
cost	O
is	O
made	O
more	O
difficult	O
by	O
the	O
entropy	B-Algorithm
encoders	I-Algorithm
in	O
modern	O
video	O
codecs	O
,	O
requiring	O
the	O
rate-distortion	B-General_Concept
optimization	I-General_Concept
algorithm	O
to	O
pass	O
each	O
block	B-General_Concept
of	O
video	O
to	O
be	O
tested	O
to	O
the	O
entropy	B-Algorithm
coder	I-Algorithm
to	O
measure	O
its	O
actual	O
bit	O
cost	O
.	O
</s>
<s>
In	O
MPEG	O
codecs	O
,	O
the	O
full	O
process	O
consists	O
of	O
a	O
discrete	B-General_Concept
cosine	I-General_Concept
transform	I-General_Concept
,	O
followed	O
by	O
quantization	B-Algorithm
and	O
entropy	B-Algorithm
encoding	I-Algorithm
.	O
</s>
<s>
Because	O
of	O
this	O
,	O
rate-distortion	B-General_Concept
optimization	I-General_Concept
is	O
much	O
slower	O
than	O
most	O
other	O
block-matching	O
metrics	O
,	O
such	O
as	O
the	O
simple	O
sum	B-Algorithm
of	I-Algorithm
absolute	I-Algorithm
differences	I-Algorithm
(	O
SAD	O
)	O
and	O
sum	B-Algorithm
of	I-Algorithm
absolute	I-Algorithm
transformed	I-Algorithm
differences	I-Algorithm
(	O
SATD	B-Algorithm
)	O
.	O
</s>
<s>
As	O
such	O
it	O
is	O
usually	O
used	O
only	O
for	O
the	O
final	O
steps	O
of	O
the	O
motion	O
estimation	O
process	O
,	O
such	O
as	O
deciding	O
between	O
different	O
partition	O
types	O
in	O
H.264/AVC	B-Application
.	O
</s>
