* With this fix the frame buffer will be updated instantly after loading or creating
new images with the copy_to_fb flag set to true.
* There's no need to flush the framebuffer after loading or creating images anymore,
however the sensor (or image) flush() still needs to be called after drawing to see the updates.
* Optimized code to make it run slightly faster.
* Added fov argument to control the zoom effect better.
* Added perspective correction through 4 point correspondence.
With this commit fb_alloc now takes hints to better decide which ram to
give (internal or sdram).
Only fb_alloc_all calls are given any hints right now as some of the
calls need as much ram as possible and will cause failures to happen if
a small amount of fast internal sram is returned.
Anyway, hints can be used to tune where things are placed by fb_alloc.
This commit fixes the following:
* Adds new methods to allow jpeg images to be encoded for transmission
to the IDE.
* Auomatically calls these methods to send the image to the IDE when
there's not enough space in the JPEG buffer. This isn't the fastest but
is better than help support requests about why it doesn't work at all.
This fix creates a flag that prevents fb_alloc_free_till_mark() from
doing anything unless there was a previous fb_alloc_mark(). Once
fb_alloc_free_till_mark() is called it will no longer do anything until
there's another fb_alloc_mark().
This means that if an exception is triggered while in code that
previously did fb_alloc_mark() the stack will be cleaned up.
If the fb_alloc_mark() method is not called then the stack will not be
cleaned up and that memory fb_alloc()'ed will remain until a soft reset.
All OpenMV Cam library code is designed to fb_alloc_mark() before using
the fb stack and then fb_alloc_free_till_mark() when complete. However,
in the case of py_sensor_alloc_extra_fb() it doesn't mark first such
that the RAM it allocates stays across exceptions and is only free'd via
py_sensor_dealloc_extra_fb() or via a soft reset.
...
Summary of changes:
fb_alloc.c -> Added a semaphore lock to prevent
fb_alloc_free_till_mark() from doing anything unless fb_alloc_mark() was
called first.
py_sensor.c -> Removed calling fb_alloc_mark() and
fb_alloc_free_till_mark() and re-arranged code calls to prevent a trival
leak sitatuion on heap exhaustion.
py_image.c, py_fir.c, py_lcd.c py_tv.c -> Added fb_alloc_mark() and
fb_alloc_free_till_mark() to methods originally coded without using it.
...
Note - I coded the mark semaphore lock in such a way things work even if
fb_alloc_mark() and fb_alloc_free_till_mark() calls are nested. This
allows the find_blobs() call-back methods to call py_image.c methods
still and also allows us to add more call-backs in the future without
worry if we need to.
...
Finally, if you have an exception in an interrupt handler all this above
breaks terribly. Given MP already breaks if you try to allocate memory
in an exception this is a "won't fix problem". Don't call code that can
have exceptions or needs memory in an interrupt handler.
* This format is for use in the Image Lib module since sensor is where
we put the image types.
Will work on the lepton and global shutter drivers next.