rav1e have 11 speed levels, 0 to 10, each tuned to give reasonable quality to speed trade-off for each use-case.
Previously, by default, all speed levels had
--rdo-lookahed-frames set to 40, which at the time was a reasonable decision as it gave the encoder plenty of lookahead to make coding decision on.
In recent benchmarking of encoder settings, we discovered that the high and constant value of lookahead is excessive for higher speeds. Relative time spends on rdo lookahead increase with increasing encoding speed preset and gains decrease.
In changing encoder presets we need to balance 2 things: Speed Gain and Quality Decrease.
As speed gain, we took the average difference of encoding time between baseline and different
--rdo-lookahed-frames settings, in a range from 30 to 10.
The quality difference was measured by BD-rate (Bjontegaard rate). It allows measurement of bitrate difference between codecs or features of codec at the same quality, for used metric. The rate change is computed as the average percent difference in rate over a range of qualities.
In simple terms, how much more bits encoder needs to achieve the same quality, on average.
- Negative values of BD-rate: bit-rate saves, better
- Positive values do BD-rate: bit-rate expenses, worse
This graph shows what average speed difference is expected by changing
--rdo-lookahed-frames from default 40.
As we can see, the biggest change occurs at speed 10, around 12% for
--rdo-lookahed-frames 10, after that speed up is steady for speeds 9 to 5 and after that decrease for speeds 4 to 1.
Now, let's look at the quality trade-off.
As we can see, speeds 10 and 9 have the lowest impact on quality, for speed 9 data even show that
--rdo-lookahed-frames 30 have a negative BD-rate, which is of course just noise of data. Given this, it's reasonable to set
--rdo-lookahed-frames 10 for speeds 10 and 9.
After speed 9 BD-rate difference increase, especially for the lowest value of 10, and ~1% of BD-rate difference is a sensible trade-off, we found it reasonable to set
--rdo-lookahed-frames 20 for speeds 8,7,6. Speeds lower than 6 are high-quality presets and it's important to make them faster but also make them good, so we decided to set
--rdo-lookahed-frames 30 for speeds 5,4,3 as it gives small speed up with the marginal difference in BD-rate, and left the highest quality presets unchanged.
For speeds 10,9 --
For speeds 8,7,6 -
For speeds 5,4,3 -
For speeds 2,1,0 -