Use main RAM block exclusively for frame buffers

* Remove malloc's on the main RAM block.
This commit is contained in:
iabdalkader 2014-02-01 20:44:53 +02:00
parent 9cddd79abd
commit 4609f0295e
2 changed files with 8 additions and 3 deletions

View File

@ -472,7 +472,6 @@ struct array *imlib_merge_detections(struct array *rectangles)
return objects;
}
struct array *imlib_detect_objects(struct cascade *cascade, struct frame_buffer *fb)
{
/* scaling factor */
@ -492,7 +491,8 @@ struct array *imlib_detect_objects(struct cascade *cascade, struct frame_buffer
/* allocate buffer for integral image */
sum.width = fb->width;
sum.height = fb->height;
sum.data = malloc(fb->width *fb->height*sizeof(*sum.data));
//sum.data = malloc(fb->width *fb->height*sizeof(*sum.data));
sum.data = (uint32_t*) fb->pixels+(fb->width * fb->height * 2);
/* allocate the detections array */
array_alloc(&objects, free);
@ -534,7 +534,7 @@ struct array *imlib_detect_objects(struct cascade *cascade, struct frame_buffer
ScaleImageInvoker(cascade, factor, sum.height, sum.width, objects);
}
free(sum.data);
//free(sum.data);
objects = imlib_merge_detections(objects);
return objects;

View File

@ -496,11 +496,16 @@ int sensor_set_framesize(struct sensor_dev *sensor, enum sensor_framesize frames
return -1;
}
#if 0
/* realloc frame buffer */
if ((fb->pixels = realloc(/* always allocate 2 bpp */
fb->pixels, fb->width * fb->height * 2)) == NULL) {
return -1;
}
#else
extern char _heap_start;
fb->pixels = &_heap_start;
#endif
/* Reconfigure the DMA stream */
dma_config(fb->pixels, fb->width * fb->height * 2);