mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-21 06:33:31 +00:00
0d868515a5
Internally libyuv uses malloc & free for short time dynamic memory allocation during image transformation. The converted images are such large, that the Libc allocator will create and destroy new Genode dataspace per image. In time sensitive code paths, the overhead can be noticeable by the caller of the image transformation. The patch adds the option to register callbacks in the libyuv library to implement the image allocation by users of the library. They may implement caching strategies to avoid the overhead, e.g. as seen with qemu-usb and the webcam model.
27 lines
688 B
C++
27 lines
688 B
C++
/*
|
|
* \brief Libyuv initialization to overwrite default libc memory/free allocator
|
|
* \author Alexander Boettcher
|
|
* \date 2023-09-15
|
|
*/
|
|
|
|
/*
|
|
* Copyright (C) 2023 Genode Labs GmbH
|
|
*
|
|
* This file is part of the Genode OS framework, which is distributed
|
|
* under the terms of the GNU Affero General Public License version 3.
|
|
*/
|
|
|
|
#ifndef _INCLUDE__LIBYUV__LIBYUV_H_
|
|
#define _INCLUDE__LIBYUV__LIBYUV_H_
|
|
|
|
/* use same namespace as used in contrib libyuv sources */
|
|
namespace libyuv
|
|
{
|
|
typedef void * (*type_malloc)(unsigned long);
|
|
typedef void (*type_free )(void *);
|
|
|
|
extern "C" void libyuv_init(type_malloc os_malloc, type_free os_free);
|
|
}
|
|
|
|
#endif /* _INCLUDE__LIBYUV_LIBYUV_H_ */
|