This patch contains very simple modification for adaptive rendering. Now it works only for CPUDevice, but it is expandable for other types of devices.
The settings is placed under Sampling Category and contains this values:
Norm - || rgb_current - rgb_previous || - distance between two colors of same pixels after "Step" samples
Step - the step of checking in loop over samples
Confirm - the count of repeated checks
Log - it helps for finding "Norm" value
BPT - AA_Samples - maximum samples
PT - Samples - maximum samples
This patch can save lot of rendering times.