Image copy between extra framebuffers regardless of pixelformat or framesize

I get 40 FPS with RGB565 VGA with this on the H7 Plus:

# Untitled - By: kwagy - Tue Sep 10 2024

import sensor, image, time

sensor.reset()
sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sensor.VGA)
sensor.skip_frames(time = 2000)

clock = time.clock()

fb0 = sensor.alloc_extra_fb(sensor.width(), sensor.height(), sensor.RGB565)
fb1 = sensor.alloc_extra_fb(sensor.width(), sensor.height(), sensor.RGB565)

i = 0
fbs = [fb0, fb1]
fbs[i].replace(sensor.snapshot())
i = i ^ 1

while(True):
    clock.tick()
    img = sensor.snapshot()
    start = time.ticks_us()
    fbs[i].replace(img)
    i = i ^ 1
    img.difference(fbs[i])
    print(clock.fps(), time.ticks_diff(time.ticks_us(), start))

40.3264 19640

Looks like the overhead of the processing is 20ms.