It occurred to me that the camera must already have a similar routine built in - if only I could find it. I will keep digging.
Of course this must be true. This could be a good project for someone who want to get into reverse engineering the firmware.
One place where this information must be evaluated is in the canon firmware autofocus code. Some signposts might be found in the firmware by looking for strings related to "AF*"
I see "AFScanDriver.c", "AFDataManager.c", "AFIntSrvTask, "AFInteg.c", "SinglAF.c", "AFParam.c", "AFCalc.c" etc.
Also nearby "Peak Exist" "No Peak" (in an AFCalc.c function)