1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/media/libvpx/vpx_mem/include/vpx_mem_intrnl.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,95 @@ 1.4 +/* 1.5 + * Copyright (c) 2010 The WebM project authors. All Rights Reserved. 1.6 + * 1.7 + * Use of this source code is governed by a BSD-style license 1.8 + * that can be found in the LICENSE file in the root of the source 1.9 + * tree. An additional intellectual property rights grant can be found 1.10 + * in the file PATENTS. All contributing project authors may 1.11 + * be found in the AUTHORS file in the root of the source tree. 1.12 + */ 1.13 + 1.14 + 1.15 +#ifndef __VPX_MEM_INTRNL_H__ 1.16 +#define __VPX_MEM_INTRNL_H__ 1.17 +#include "./vpx_config.h" 1.18 + 1.19 +#ifndef CONFIG_MEM_MANAGER 1.20 +# if defined(VXWORKS) 1.21 +# define CONFIG_MEM_MANAGER 1 /*include heap manager functionality,*/ 1.22 +/*default: enabled on vxworks*/ 1.23 +# else 1.24 +# define CONFIG_MEM_MANAGER 0 /*include heap manager functionality*/ 1.25 +# endif 1.26 +#endif /*CONFIG_MEM_MANAGER*/ 1.27 + 1.28 +#ifndef CONFIG_MEM_TRACKER 1.29 +# define CONFIG_MEM_TRACKER 1 /*include xvpx_* calls in the lib*/ 1.30 +#endif 1.31 + 1.32 +#ifndef CONFIG_MEM_CHECKS 1.33 +# define CONFIG_MEM_CHECKS 0 /*include some basic safety checks in 1.34 +vpx_memcpy, _memset, and _memmove*/ 1.35 +#endif 1.36 + 1.37 +#ifndef USE_GLOBAL_FUNCTION_POINTERS 1.38 +# define USE_GLOBAL_FUNCTION_POINTERS 0 /*use function pointers instead of compiled functions.*/ 1.39 +#endif 1.40 + 1.41 +#if CONFIG_MEM_TRACKER 1.42 +# include "vpx_mem_tracker.h" 1.43 +# if VPX_MEM_TRACKER_VERSION_CHIEF != 2 || VPX_MEM_TRACKER_VERSION_MAJOR != 5 1.44 +# error "vpx_mem requires memory tracker version 2.5 to track memory usage" 1.45 +# endif 1.46 +#endif 1.47 + 1.48 +#define ADDRESS_STORAGE_SIZE sizeof(size_t) 1.49 + 1.50 +#ifndef DEFAULT_ALIGNMENT 1.51 +# if defined(VXWORKS) 1.52 +# define DEFAULT_ALIGNMENT 32 /*default addr alignment to use in 1.53 +calls to vpx_* functions other 1.54 +than vpx_memalign*/ 1.55 +# else 1.56 +# define DEFAULT_ALIGNMENT (2 * sizeof(void*)) /* NOLINT */ 1.57 +# endif 1.58 +#endif 1.59 + 1.60 +#if CONFIG_MEM_TRACKER 1.61 +# define TRY_BOUNDS_CHECK 1 /*when set to 1 pads each allocation, 1.62 +integrity can be checked using 1.63 +vpx_memory_tracker_check_integrity 1.64 +or on free by defining*/ 1.65 +/*TRY_BOUNDS_CHECK_ON_FREE*/ 1.66 +#else 1.67 +# define TRY_BOUNDS_CHECK 0 1.68 +#endif /*CONFIG_MEM_TRACKER*/ 1.69 + 1.70 +#if TRY_BOUNDS_CHECK 1.71 +# define TRY_BOUNDS_CHECK_ON_FREE 0 /*checks mem integrity on every 1.72 +free, very expensive*/ 1.73 +# define BOUNDS_CHECK_VALUE 0xdeadbeef /*value stored before/after ea. 1.74 +mem addr for bounds checking*/ 1.75 +# define BOUNDS_CHECK_PAD_SIZE 32 /*size of the padding before and 1.76 +after ea allocation to be filled 1.77 +with BOUNDS_CHECK_VALUE. 1.78 +this should be a multiple of 4*/ 1.79 +#else 1.80 +# define BOUNDS_CHECK_VALUE 0 1.81 +# define BOUNDS_CHECK_PAD_SIZE 0 1.82 +#endif /*TRY_BOUNDS_CHECK*/ 1.83 + 1.84 +#ifndef REMOVE_PRINTFS 1.85 +# define REMOVE_PRINTFS 0 1.86 +#endif 1.87 + 1.88 +/* Should probably use a vpx_mem logger function. */ 1.89 +#if REMOVE_PRINTFS 1.90 +# define _P(x) 1.91 +#else 1.92 +# define _P(x) x 1.93 +#endif 1.94 + 1.95 +/*returns an addr aligned to the byte boundary specified by align*/ 1.96 +#define align_addr(addr,align) (void*)(((size_t)(addr) + ((align) - 1)) & (size_t)-(align)) 1.97 + 1.98 +#endif /*__VPX_MEM_INTRNL_H__*/