Skip to content

Commit d2d5e35

Browse files
authored
Merge pull request #165 from baba-dev/codex/optimize-canvas-buffer-handling-in-app_camera_display
perf: improve camera canvas refresh
2 parents 8af4dbd + d8b2f4c commit d2d5e35

1 file changed

Lines changed: 12 additions & 5 deletions

File tree

platforms/tab5/main/hal/components/hal_camera.cpp

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,13 @@ void app_camera_display(void* arg)
326326
{
327327
ESP_LOGE(TAG, "malloc for img_show->data failed");
328328
}
329+
330+
if ((img_show->data != NULL) && (camera_canvas != NULL)) {
331+
bsp_display_lock(0);
332+
lv_canvas_set_buffer(
333+
camera_canvas, img_show->data, CAMERA_WIDTH, CAMERA_HEIGHT, LV_COLOR_FORMAT_RGB565);
334+
bsp_display_unlock();
335+
}
329336
}
330337

331338
ppa_client_handle_t ppa_srm_handle = NULL;
@@ -386,11 +393,11 @@ void app_camera_display(void* arg)
386393

387394
// auto detect_results = human_face_detector->run(dl_img); // format: hwc
388395

389-
bsp_display_lock(0);
390-
lv_canvas_set_buffer(
391-
camera_canvas, img_show->data, CAMERA_WIDTH, CAMERA_HEIGHT, LV_COLOR_FORMAT_RGB565);
392-
bsp_display_unlock();
393-
396+
if (camera_canvas != NULL) {
397+
bsp_display_lock(0);
398+
lv_obj_invalidate(camera_canvas);
399+
bsp_display_unlock();
400+
}
394401
if (ioctl(camera->fd, VIDIOC_QBUF, &buf) != 0)
395402
{
396403
ESP_LOGE(TAG, "failed to free video frame");

0 commit comments

Comments
 (0)