Commit c36264a3 authored by Michael Niedermayer's avatar Michael Niedermayer

A quick description of Rate distortion theory.

Originally committed as revision 17774 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent 59701aeb
A quick description of Rate distortion theory.
We want to encode a video, picture or music optimally.
What does optimally mean?
It means that we want to get the best quality at a given
filesize OR (which is almost the same actually) We want to get the
smallest filesize at a given quality.
Solving this directly isnt practical, try all byte sequences
1MB long and pick the best looking, yeah 256^1000000 cases to try ;)
But first a word about Quality also called distortion, this can
really be almost any quality meassurement one wants. Commonly the
sum of squared differenes is used but more complex things that
consider psychivisual effects can be used as well, it makes no differnce
to us here.
First step, that RD factor called lambda ...
Lets consider the problem of minimizing
distortion + lambda*rate
for a fixed lambda, rate here would be the filesize, distortion the quality
Is this equivalent to finding the best quality for a given max filesize?
The awnser is yes, for each filesize limit there is some lambda factor for
which minimizing above will get you the best quality (in your provided quality
meassurement) at that (or a lower) filesize
Second step, spliting the problem.
Directly spliting the problem of finding the best quality at a given filesize
is hard because we dont know how much filesize to assign to each of the
subproblems optimally.
But distortion + lambda*rate can trivially be split
just consider
(distortion0 + distortion1) + lambda*(rate0 +rate1)
a problem made of 2 independant subproblems, the subproblems might be 2
16x16 macroblocks in a frame of 32x16 size.
to minimize
(distortion0 + distortion1) + lambda*(rate0 +rate1)
one just have to minimize
distortion0 + lambda*rate0
and
distortion1 + lambda*rate1
aka the 2 problems can be solved independantly
Author: Michael Niedermayer
Copyright: LGPL
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment