Use fb_alloc_mark to avoid dealloc'ing the extra FB.

This commit is contained in:
iabdalkader 2019-01-31 21:51:17 +02:00
parent 0224693d63
commit f01e451bb4
2 changed files with 9 additions and 3 deletions

View File

@ -199,6 +199,8 @@ array_t *imlib_selective_search(image_t *src, float t, int min_size, float a1, f
int width=0, height=0;
image_t *img = NULL;
fb_alloc_mark();
if ((src->w * src->h) <= (80 * 60)) {
img = src;
width = src->w;
@ -440,7 +442,7 @@ array_t *imlib_selective_search(image_t *src, float t, int min_size, float a1, f
r->h *=4;
}
}
fb_free_all();
fb_alloc_free_till_mark();
return proposals;
}
#endif //IMLIB_ENABLE_SELECTIVE_SEARCH

View File

@ -359,6 +359,8 @@ int nn_run_network(nn_t *net, image_t *img, rectangle_t *roi, bool softmax)
q7_t *input_buffer = NULL;
q7_t *output_buffer = NULL;
fb_alloc_mark();
q7_t *buffer1 = fb_alloc(net->max_scrbuf_size);
q7_t *buffer2 = buffer1 + net->max_layer_size;
q7_t *col_buffer = fb_alloc(net->max_colbuf_size);
@ -449,7 +451,7 @@ int nn_run_network(nn_t *net, image_t *img, rectangle_t *roi, bool softmax)
arm_softmax_q7(net->output_data, net->output_size, net->output_data);
}
fb_free_all();
fb_alloc_free_till_mark();
return 0;
}
@ -485,6 +487,8 @@ int nn_dry_run_network(nn_t *net, image_t *img, bool softmax)
q7_t *input_buffer = NULL;
q7_t *output_buffer = NULL;
fb_alloc_mark();
q7_t *buffer1 = fb_alloc(net->max_scrbuf_size);
q7_t *buffer2 = buffer1 + net->max_layer_size;
@ -573,7 +577,7 @@ int nn_dry_run_network(nn_t *net, image_t *img, bool softmax)
layer = layer->next;
}
fb_free_all();
fb_alloc_free_till_mark();
printf("\n");
return 0;
}