mirror of
https://github.com/openmv/openmv.git
synced 2025-11-04 14:49:50 +08:00
Change update_jpeg_buffer arg to bool.
* Will be used to swap buffers later.
This commit is contained in:
parent
56176046bf
commit
ffdbca8cc4
@ -113,15 +113,13 @@ static void initialize_jpeg_buf_from_image(image_t *img)
|
||||
}
|
||||
}
|
||||
|
||||
void framebuffer_update_jpeg_buffer(image_t *src)
|
||||
void framebuffer_update_jpeg_buffer(bool swapfb)
|
||||
{
|
||||
image_t main_fb_src;
|
||||
static int overflow_count = 0;
|
||||
|
||||
if (src == NULL) {
|
||||
image_t main_fb_src;
|
||||
framebuffer_initialize_image(&main_fb_src);
|
||||
src = &main_fb_src;
|
||||
}
|
||||
image_t *src = &main_fb_src;
|
||||
|
||||
if (framebuffer->streaming_enabled && jpeg_framebuffer->enabled) {
|
||||
if (src->bpp > 3) {
|
||||
|
||||
@ -75,7 +75,7 @@ void framebuffer_initialize_image(image_t *img);
|
||||
// Compress src image to the JPEG buffer if src is mutable, otherwise copy src to the JPEG buffer
|
||||
// if the src is JPEG and fits in the JPEG buffer, or encode and stream src image to the IDE if not.
|
||||
// If src == NULL use main framebuffer as source image.
|
||||
void framebuffer_update_jpeg_buffer(image_t *src);
|
||||
void framebuffer_update_jpeg_buffer(bool swapfb);
|
||||
|
||||
// Set the framebuffer w, h and bpp.
|
||||
void framebuffer_set(int32_t w, int32_t h, int32_t bpp);
|
||||
|
||||
@ -1088,7 +1088,7 @@ mp_obj_t py_fir_snapshot(uint n_args, const mp_obj_t *args, mp_map_t *kw_args)
|
||||
}
|
||||
|
||||
if (copy_to_fb) {
|
||||
framebuffer_update_jpeg_buffer(NULL);
|
||||
framebuffer_update_jpeg_buffer(false);
|
||||
}
|
||||
|
||||
image_t dst_img;
|
||||
|
||||
@ -940,7 +940,7 @@ static mp_obj_t py_image_to(int bpp, const uint16_t *default_color_palette, bool
|
||||
}
|
||||
|
||||
if (copy_to_fb && copy) {
|
||||
framebuffer_update_jpeg_buffer(NULL);
|
||||
framebuffer_update_jpeg_buffer(false);
|
||||
}
|
||||
|
||||
image_t dst_img;
|
||||
@ -1205,7 +1205,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_KW(py_image_save_obj, 2, py_image_save);
|
||||
|
||||
static mp_obj_t py_image_flush(mp_obj_t img_obj)
|
||||
{
|
||||
framebuffer_update_jpeg_buffer(NULL);
|
||||
framebuffer_update_jpeg_buffer(false);
|
||||
return mp_const_none;
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(py_image_flush_obj, py_image_flush);
|
||||
@ -6574,7 +6574,7 @@ mp_obj_t py_image_load_image(uint n_args, const mp_obj_t *args, mp_map_t *kw_arg
|
||||
}
|
||||
|
||||
if (copy_to_fb) {
|
||||
framebuffer_update_jpeg_buffer(NULL);
|
||||
framebuffer_update_jpeg_buffer(false);
|
||||
}
|
||||
|
||||
return py_image_from_struct(&image);
|
||||
|
||||
@ -156,7 +156,7 @@ mp_obj_t py_imageio_read(uint n_args, const mp_obj_t *args, mp_map_t *kw_args)
|
||||
}
|
||||
|
||||
if (copy_to_fb) {
|
||||
framebuffer_update_jpeg_buffer(NULL);
|
||||
framebuffer_update_jpeg_buffer(false);
|
||||
}
|
||||
|
||||
if (0) {
|
||||
|
||||
@ -998,7 +998,7 @@ int sensor_snapshot(sensor_t *sensor, image_t *image, uint32_t flags)
|
||||
// Compress the framebuffer for the IDE preview, only if it's not the first frame,
|
||||
// the framebuffer is enabled and the image sensor does not support JPEG encoding.
|
||||
// Note: This doesn't run unless the IDE is connected and the framebuffer is enabled.
|
||||
framebuffer_update_jpeg_buffer(NULL);
|
||||
framebuffer_update_jpeg_buffer(false);
|
||||
|
||||
noInterrupts();
|
||||
|
||||
|
||||
@ -1282,7 +1282,7 @@ int sensor_snapshot(sensor_t *sensor, image_t *image, uint32_t flags)
|
||||
// Compress the framebuffer for the IDE preview, only if it's not the first frame,
|
||||
// the framebuffer is enabled and the image sensor does not support JPEG encoding.
|
||||
// Note: This doesn't run unless the IDE is connected and the framebuffer is enabled.
|
||||
framebuffer_update_jpeg_buffer(NULL);
|
||||
framebuffer_update_jpeg_buffer(false);
|
||||
|
||||
// Make sure the raw frame fits into the FB. It will be switched from RGB565 to BAYER
|
||||
// first to save space before being cropped until it fits.
|
||||
|
||||
@ -484,7 +484,7 @@ static int sensor_check_buffsize(sensor_t *sensor)
|
||||
|
||||
static int snapshot(sensor_t *sensor, image_t *image, uint32_t flags)
|
||||
{
|
||||
framebuffer_update_jpeg_buffer(NULL);
|
||||
framebuffer_update_jpeg_buffer(false);
|
||||
|
||||
if (sensor_check_buffsize(sensor) == -1) {
|
||||
return -1;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user