diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2009-03-03 16:09:19 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2009-03-03 16:09:19 +0000 |
commit | c36264a3537b932ea3220838a43e81d63b6cc2f1 (patch) | |
tree | f9c195684e4a208130f0f1af5af2ec58188f37b6 /doc | |
parent | 59701aeb46bf06b692f9952c705b049eaabda10a (diff) | |
download | ffmpeg-c36264a3537b932ea3220838a43e81d63b6cc2f1.tar.gz |
A quick description of Rate distortion theory.
Originally committed as revision 17774 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'doc')
-rw-r--r-- | doc/rate_distortion.txt | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/doc/rate_distortion.txt b/doc/rate_distortion.txt new file mode 100644 index 0000000000..2706393191 --- /dev/null +++ b/doc/rate_distortion.txt @@ -0,0 +1,50 @@ +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 |