media/libvpx/vpx_mem/include/vpx_mem_intrnl.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /*
michael@0 2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
michael@0 3 *
michael@0 4 * Use of this source code is governed by a BSD-style license
michael@0 5 * that can be found in the LICENSE file in the root of the source
michael@0 6 * tree. An additional intellectual property rights grant can be found
michael@0 7 * in the file PATENTS. All contributing project authors may
michael@0 8 * be found in the AUTHORS file in the root of the source tree.
michael@0 9 */
michael@0 10
michael@0 11
michael@0 12 #ifndef __VPX_MEM_INTRNL_H__
michael@0 13 #define __VPX_MEM_INTRNL_H__
michael@0 14 #include "./vpx_config.h"
michael@0 15
michael@0 16 #ifndef CONFIG_MEM_MANAGER
michael@0 17 # if defined(VXWORKS)
michael@0 18 # define CONFIG_MEM_MANAGER 1 /*include heap manager functionality,*/
michael@0 19 /*default: enabled on vxworks*/
michael@0 20 # else
michael@0 21 # define CONFIG_MEM_MANAGER 0 /*include heap manager functionality*/
michael@0 22 # endif
michael@0 23 #endif /*CONFIG_MEM_MANAGER*/
michael@0 24
michael@0 25 #ifndef CONFIG_MEM_TRACKER
michael@0 26 # define CONFIG_MEM_TRACKER 1 /*include xvpx_* calls in the lib*/
michael@0 27 #endif
michael@0 28
michael@0 29 #ifndef CONFIG_MEM_CHECKS
michael@0 30 # define CONFIG_MEM_CHECKS 0 /*include some basic safety checks in
michael@0 31 vpx_memcpy, _memset, and _memmove*/
michael@0 32 #endif
michael@0 33
michael@0 34 #ifndef USE_GLOBAL_FUNCTION_POINTERS
michael@0 35 # define USE_GLOBAL_FUNCTION_POINTERS 0 /*use function pointers instead of compiled functions.*/
michael@0 36 #endif
michael@0 37
michael@0 38 #if CONFIG_MEM_TRACKER
michael@0 39 # include "vpx_mem_tracker.h"
michael@0 40 # if VPX_MEM_TRACKER_VERSION_CHIEF != 2 || VPX_MEM_TRACKER_VERSION_MAJOR != 5
michael@0 41 # error "vpx_mem requires memory tracker version 2.5 to track memory usage"
michael@0 42 # endif
michael@0 43 #endif
michael@0 44
michael@0 45 #define ADDRESS_STORAGE_SIZE sizeof(size_t)
michael@0 46
michael@0 47 #ifndef DEFAULT_ALIGNMENT
michael@0 48 # if defined(VXWORKS)
michael@0 49 # define DEFAULT_ALIGNMENT 32 /*default addr alignment to use in
michael@0 50 calls to vpx_* functions other
michael@0 51 than vpx_memalign*/
michael@0 52 # else
michael@0 53 # define DEFAULT_ALIGNMENT (2 * sizeof(void*)) /* NOLINT */
michael@0 54 # endif
michael@0 55 #endif
michael@0 56
michael@0 57 #if CONFIG_MEM_TRACKER
michael@0 58 # define TRY_BOUNDS_CHECK 1 /*when set to 1 pads each allocation,
michael@0 59 integrity can be checked using
michael@0 60 vpx_memory_tracker_check_integrity
michael@0 61 or on free by defining*/
michael@0 62 /*TRY_BOUNDS_CHECK_ON_FREE*/
michael@0 63 #else
michael@0 64 # define TRY_BOUNDS_CHECK 0
michael@0 65 #endif /*CONFIG_MEM_TRACKER*/
michael@0 66
michael@0 67 #if TRY_BOUNDS_CHECK
michael@0 68 # define TRY_BOUNDS_CHECK_ON_FREE 0 /*checks mem integrity on every
michael@0 69 free, very expensive*/
michael@0 70 # define BOUNDS_CHECK_VALUE 0xdeadbeef /*value stored before/after ea.
michael@0 71 mem addr for bounds checking*/
michael@0 72 # define BOUNDS_CHECK_PAD_SIZE 32 /*size of the padding before and
michael@0 73 after ea allocation to be filled
michael@0 74 with BOUNDS_CHECK_VALUE.
michael@0 75 this should be a multiple of 4*/
michael@0 76 #else
michael@0 77 # define BOUNDS_CHECK_VALUE 0
michael@0 78 # define BOUNDS_CHECK_PAD_SIZE 0
michael@0 79 #endif /*TRY_BOUNDS_CHECK*/
michael@0 80
michael@0 81 #ifndef REMOVE_PRINTFS
michael@0 82 # define REMOVE_PRINTFS 0
michael@0 83 #endif
michael@0 84
michael@0 85 /* Should probably use a vpx_mem logger function. */
michael@0 86 #if REMOVE_PRINTFS
michael@0 87 # define _P(x)
michael@0 88 #else
michael@0 89 # define _P(x) x
michael@0 90 #endif
michael@0 91
michael@0 92 /*returns an addr aligned to the byte boundary specified by align*/
michael@0 93 #define align_addr(addr,align) (void*)(((size_t)(addr) + ((align) - 1)) & (size_t)-(align))
michael@0 94
michael@0 95 #endif /*__VPX_MEM_INTRNL_H__*/

mercurial