In your example graphic, wouldn't my proposed solution above fit it perfectly?
If the CFR frame fits in the VFR frame, take that VFR frame. CFR frames 0 and 1 fits in VFR frame 0. CFR frames 4 and 5 fit in VFR frame 3.
Else if there are multiple VFR frames to choose from, take the largest. CFR frame 2 can choose from VFR frame 0 and 1, but since VFR frame 0 takes most of the time in the CFR frame, VFR frame 0 is chosen. Similarly, CFR frame 3 can choose from VFR frames 1 and 2, but since VFR frame 1 takes most of the time in the CFR frame, VFR frame 1 is chosen.
|